isapir / Migrate2Postgres

Easily migrate from other DBMSs to PostgreSQL
GNU General Public License v3.0
52 stars 24 forks source link

SCHEMA in uppercase #11

Open ghost opened 5 years ago

ghost commented 5 years ago

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

isapir commented 5 years ago

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 commented 5 years ago

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.

ghost commented 5 years ago

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.