We have a legacy database that has been migrated to PostgreSQL and
includes camel-case table names. When running migrations, the schema
dumper throws an error when it encounters these tables. I believe I've
created and tested the proper solution to this in the postgresql
adapter. Please see the following ticket for details:
We have a legacy database that has been migrated to PostgreSQL and
includes camel-case table names. When running migrations, the schema
dumper throws an error when it encounters these tables. I believe I've
created and tested the proper solution to this in the postgresql
adapter. Please see the following ticket for details:
I would appreciate it if someone could take a look at the patch and
tests and see if there should be any other improvements.
+ # The name is a string. It could contain a schema, which shouldn't
+ # be included in the quotes.
+ schema, table_name = name.split('.')
+ if schema && table_name
+ %(#{schema}."#{table_name}")
However, that patch still doesn't quote table names when casting to
regclass, so I've adjusted my patch so that it uses the new
quote_table_name method instead. I also integrated my tests with the
new patch. Here's my new patch:
So to summarize, ticket #390 implemented table quoting to allow non-
default schemas to be specified. My ticket #2418 now piggybacks on
that to prevent a PGError when capitalized table names are used.
I've tested this on MacOS 10.5 using PostgreSQL 8.2.11 and each of the
"pg" and "postgres" gems. I'd appreciate it if others could verify
this (or other platforms) as well.