Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:JRuby 1.1.4, activerecord.jdbc-0.8.2, sun java 1.6.0_06, derby 10.4
-
Number of attachments :
Description
When creating a table with a column called "year" in a migration script and running it against derby using the activerecord-jdbc-derby adapter, the migration step fails with the error:
/usr/local/jruby-1.1.4/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:147:in `log': ActiveRecord::ActiveRecordError: Syntax error: Encountered "year" at line 1, column 153.: CREATE TABLE attendances (id int generated by default as identity NOT NULL PRIMARY KEY, member_id integer NOT NULL, group_schedule_id integer NOT NULL, year integer NOT NULL, week integer NOT NULL, created_at timestamp, updated_at timestamp) (ActiveRecord::StatementInvalid)
The "year" column should be quoted since it is a reserved word in derby.
If there is a workaround for this, please let me know.
Add logic to quote it? To be honest, I'd really like to have more people familiar with the internals of AR-JDBC, and it's really not that bad of code (don't think it's as crazy as AR itself). I'm sure we'll try to look into it, but anything you can to to educate yourself and the wiki would be greatly appreciated