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

Michael A. Schoen
2007-05-29T18:18:52Z

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?