I discovered a simple workaround for this, instead of:

create_table :references do |t|
end

use:

create_table '`references`' do |t|
end

and, in model Reference, set_table_name to '`references`'.

But it's still ugly...

Erik

On Jun 5, 3:18 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> When creating tables using migrations (and possibly other operations
> that result in DB interaction) and using table  or column names which
> are reserved MySQL keywords, i.e. references, the following error
> occurs:
>
> Mysql::Error: #42000You have an error in your SQL syntax; check the
> manual that corresponds to your MySQL server version for the right
> syntax to use near 'references (`id` int(11) DEFAULT NULL
> auto_increment PRIMARY KEY, `label` varcha' at line 1: CREATE TABLE
> references (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY,
> `label` varchar(255) NOT NULL, `url` varchar(255) NOT NULL)
> ENGINE=InnoDB
>
> Shouldn't the Rails MySQL driver escape all identifiers with
> backquotes or something equivalent?
>
> Erik


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to