Postgres problem


#1

I get the following error:


PGError: ERROR: syntax error at or near “default”
RAD 1: SELECT * FROM ivr_menus ORDER BY default LIMIT 20 OFFSET 0
^
: SELECT * FROM ivr_menus ORDER BY default LIMIT 20 OFFSET 0


Why?
Table definition:

class CreateIvrMenus < ActiveRecord::Migration
def self.up
create_table :ivr_menus do |t|
t.integer :parent_id
t.string :name, :limit => 20
t.integer :schedule_id
t.string :open_phrase
t.string :close_phrase
t.integer :close_action
t.string :close_action_value
t.integer :timeout_action
t.string :timeout_action_value
t.string :timeout_phrase
end
end

def self.down
drop_table :ivr_menus
end
end


#2

On Monday 11 June 2007, Jonas wrote:


Why?

Because default is an SQL keyword. You need to provide a column name (or
rather an expression) and optionally either ASC or DESC.

Michael


Michael S.
mailto:removed_email_address@domain.invalid
http://www.schuerig.de/michael/


#3

On Monday 11 June 2007, Jonas wrote:

Michael S. wrote:

On Monday 11 June 2007, Jonas wrote:


Why?

Because default is an SQL keyword. You need to provide a column
name (or rather an expression) and optionally either ASC or DESC.

But I do not have a column called “default”. I do not understand
where the word “default” comes from in the query.

To give us a chance of solving your problem you’ll have to show us the
code that results in this query being executed

PGError: ERROR: syntax error at or near “default”
RAD 1: SELECT * FROM ivr_menus ORDER BY default LIMIT 20 OFFSET 0
^

: SELECT * FROM ivr_menus ORDER BY default LIMIT 20 OFFSET 0

Michael


Michael S.
mailto:removed_email_address@domain.invalid
http://www.schuerig.de/michael/


#4

Michael S. wrote:

On Monday 11 June 2007, Jonas wrote:


Why?

Because default is an SQL keyword. You need to provide a column name (or
rather an expression) and optionally either ASC or DESC.

Michael


Michael S.
mailto:removed_email_address@domain.invalid
http://www.schuerig.de/michael/

But I do not have a column called “default”. I do not understand where
the word “default” comes from in the query.