darold / ora2pg

Ora2Pg is a free tool used to migrate an Oracle database to a PostgreSQL compatible schema. It connects your Oracle database, scan it automatically and extracts its structure or data, it then generates SQL scripts that you can load into PostgreSQL.
http://www.ora2pg.com/
GNU General Public License v3.0
978 stars 341 forks source link

name of a column is a reserved word in postgresql #1693

Closed didmicang closed 5 months ago

didmicang commented 9 months ago

When migrating from Oracle to PostgreSQL with ora2pg v24.1 , I have the following problem :
CREATE TABLE gestion_couleur ( couleur_pas bigint NOT NULL, couleur_pas_correctif bigint NOT NULL, derniere_couleur varchar(10) NOT NULL, offset bigint NOT NULL, <---- Reserved word delta_minimal bigint NOT NULL ) ; How to fix the problem ?

faqsarg commented 9 months ago

I had the same problem with a 'desc' column. I think this problem is beyond the scope of ora2pg. I think you should fix it manually before performing the migration. If it is a possibility, modify the name of that column in your Oracle db.

darold commented 9 months ago

You should enable USE_RESERVED_WORDS in ora2pg.conf, the column will be double quoted in ora2pg export.

darold commented 9 months ago

I agree with @faqsarg that renaming the column could be a better solution otherwise each time you will use this column you will need to add double quote.