Migrate2Postgres icon indicating copy to clipboard operation
Migrate2Postgres copied to clipboard

SCHEMA in uppercase

Open ghost opened this issue 6 years ago • 3 comments

Hi

Thank you for this wonderful tool.

I have a huge db with camelcase tables - would love to see support for this as well since changing it now is not an option.

Thanks

ghost avatar Feb 06 '19 13:02 ghost

The only way to maintain the CaSe in Postgres is by using quotes, e.g.

CREATE TABLE "Users";

But that means that every time you reference that object you need to use quotes with the exact same CaSe, so this will error as no such table:

-- error, would not work
SELECT * FROM users;

-- error, would not work, even though case is correct
SELECT * FROM Users;

The only way to use it would be to add quotes and the correct case every time:

-- correct CaSe and quotes works
SELECT * FROM "Users";

I can add that feature, but I find this to be unusable. If more people will request it then I will reconsider.

isapir avatar Feb 08 '19 00:02 isapir

You can keep the schema casing unchanged. Simply do not specify any transformation. It will work as the SQL standard is case-insensitive.

The only thing you wouldn't get is the original case in your result sets. All the columns will collapse to lowercase.

isapir avatar Feb 08 '19 00:02 isapir

Thank you for this answer - I have problem transfering records - it expects schema with lowercase. I'll dig futher to find another solution. Luckily I have another similar db transfer project that has proper casing - will try this with that one.

ghost avatar Feb 11 '19 08:02 ghost