Re: Rails AR/Oracle Unit Test: [6892] failed (but getting better)

Jeremy Kemper
2007-05-29T08:50:48Z

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