isapir / Migrate2Postgres

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

How avoid postgresql from folding to lowercase #10

Closed FrancisOfosu105 closed 5 years ago

FrancisOfosu105 commented 5 years ago

I'm trying to move a legacy application's database from sql server to postgresql. I want to maintain the casing of the table and column names. Currently this is what the script the app is generating. I have trimmed the rest for brevity sake.

CREATE TABLE public.aspnet_Applications ( ApplicationName TEXT NOT NULL ,LoweredApplicationName TEXT NOT NULL ,ApplicationId CHAR(36) NOT NULL -- DEFAULT (newid()) ,Description TEXT );

After you run the script, all the table and column names will be converted to lowercase or uppercase or snake_case depending on the format you specify in the conf file. My question is, I want to know if there is a way to allow postgresql to maintain the same format for the table and column names as it was in the sql sever?

isapir commented 5 years ago

The only way to maintain the CaSing on Postgres is to quote the identifiers, but that would mean that you will always have to quote them moving forward, and maintain the exact CaSing, or else you'll get an error, therefore - it is highly discouraged.

I can add that option at some point, but I'm not sure that many users will find it useful.

FrancisOfosu105 commented 5 years ago

Thanks for replying and I also appreciate you for creating such a wonderful tool. I have to follow your recommendation and avoid quoting them.