Michael Schoen
2007-May-29 08:34 UTC
Rails AR/Oracle Unit Test: [6892] failed (but getting better)
"bitsweat" has given AR/Oracle some love, but it''s still unhappy... http://dev.rubyonrails.org/changeset/6892 ------------------------------------------------------------------------ r6892 | bitsweat | 2007-05-29 01:29:33 -0700 (Tue, 29 May 2007) | 1 line Workaround test isolation failure with Task.attr_protected :starting. ------------------------------------------------------------------------ U activerecord/test/date_time_test.rb Updated to revision 6892. 1) Failure: test_rename_column_with_sql_reserved_word(MigrationTest) [./test/migration_test.rb:403:in `test_rename_column_with_sql_reserved_word'' /usr/pkg/ruby184/lib/ruby/gems/1.8/gems/mocha-0.4.0/lib/mocha/test_case_adapter.rb:19:in `run'']: Exception raised: Class: <ActiveRecord::StatementInvalid> Message: <"OCIError: ORA-00904: : invalid identifier: ALTER TABLE people RENAME COLUMN first_name to group"> ---Backtrace--- ./test/../lib/active_record/connection_adapters/abstract_adapter.rb:135:in `log'' ./test/../lib/active_record/connection_adapters/oracle_adapter.rb:214:in `execute_without_counting'' ./test/abstract_unit.rb:71:in `execute'' ./test/../lib/active_record/connection_adapters/oracle_adapter.rb:400:in `rename_column'' ./test/migration_test.rb:403:in `test_rename_column_with_sql_reserved_word'' ./test/migration_test.rb:403:in `test_rename_column_with_sql_reserved_word'' /usr/pkg/ruby184/lib/ruby/gems/1.8/gems/mocha-0.4.0/lib/mocha/test_case_adapter.rb:19:in `run'' --------------- 1101 tests, 4118 assertions, 1 failures, 0 errors rake aborted! Command failed with status (1): [/usr/pkg/ruby184/bin/ruby -Ilib:test:test/...] (See full trace by running task with --trace) --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2007-May-29 08:50 UTC
Re: Rails AR/Oracle Unit Test: [6892] failed (but getting better)
On 5/29/07, Michael Schoen <schoenm@earthlink.net> wrote:> "bitsweat" has given AR/Oracle some love, but it''s still unhappy... > > http://dev.rubyonrails.org/changeset/6892 > ------------------------------------------------------------------------ > r6892 | bitsweat | 2007-05-29 01:29:33 -0700 (Tue, 29 May 2007) | 1 line > > Workaround test isolation failure with Task.attr_protected :starting. > ------------------------------------------------------------------------ > > U activerecord/test/date_time_test.rb > Updated to revision 6892. > > 1) Failure: > test_rename_column_with_sql_reserved_word(MigrationTest) > [./test/migration_test.rb:403:in `test_rename_column_with_sql_reserved_word'' > /usr/pkg/ruby184/lib/ruby/gems/1.8/gems/mocha-0.4.0/lib/mocha/test_case_adapter.rb:19:in `run'']: > Exception raised: > Class: <ActiveRecord::StatementInvalid> > Message: <"OCIError: ORA-00904: : invalid identifier: ALTER TABLE people RENAME COLUMN first_name to group"> > ---Backtrace--- > ./test/../lib/active_record/connection_adapters/abstract_adapter.rb:135:in `log'' > ./test/../lib/active_record/connection_adapters/oracle_adapter.rb:214:in `execute_without_counting'' > ./test/abstract_unit.rb:71:in `execute'' > ./test/../lib/active_record/connection_adapters/oracle_adapter.rb:400:in `rename_column'' > ./test/migration_test.rb:403:in `test_rename_column_with_sql_reserved_word'' > ./test/migration_test.rb:403:in `test_rename_column_with_sql_reserved_word'' > /usr/pkg/ruby184/lib/ruby/gems/1.8/gems/mocha-0.4.0/lib/mocha/test_case_adapter.rb:19:in `run'' > --------------- > > 1101 tests, 4118 assertions, 1 failures, 0 errors > rake aborted! > Command failed with status (1): [/usr/pkg/ruby184/bin/ruby -Ilib:test:test/...] > > (See full trace by running task with --trace)The Oracle adapter''s quote_column_name: # camelCase column names need to be quoted; not that anyone using Oracle # would really do this, but handling this case means we pass the test... def quote_column_name(name) #:nodoc: name.to_s =~ /[A-Z]/ ? "\"#{name}\"" : name end Presumably to avoid having your DBA lowercase existing column names? jeremy --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael A. Schoen
2007-May-29 18:18 UTC
Re: Rails AR/Oracle Unit Test: [6892] failed (but getting better)
Jeremy Kemper wrote:> The Oracle adapter''s quote_column_name: > > # camelCase column names need to be quoted; not that anyone using Oracle > # would really do this, but handling this case means we pass the test... > def quote_column_name(name) #:nodoc: > name.to_s =~ /[A-Z]/ ? "\"#{name}\"" : name > end > > Presumably to avoid having your DBA lowercase existing column names?Sort of. Oracle is generally case-insensitive, and 99.9% of folks don''t quote column names, effectively making them uppercase. The implementation above satisfied the test case of somebody using a mixed-case name, which is very unexpected when using Oracle. It''s also bad form to use a reserved word for a column name, even if that''s technically possible by quoting the name. Quoting all names in order to make this work would have a very negative impact, as it would break the current nice behavior of lowercase column names in Ruby and case-insensitive names in Oracle. I can either provide a patch that quotes column names only if they''re reserved words, or just punt and have this specific test not run for Oracle. Thoughts? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Glaesemann
2007-May-29 19:54 UTC
Re: Rails AR/Oracle Unit Test: [6892] failed (but getting better)
On May 29, 2007, at 13:18 , Michael A. Schoen wrote:> Sort of. Oracle is generally case-insensitive, and 99.9% of folks > don''t > quote column names, effectively making them uppercase.Note that this is per SQL-spec. (Another data point: for historical reasons, PostgreSQL downcases unquoted identifiers.) Michael Glaesemann grzm seespotcode net --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---