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
1.02k stars 343 forks source link

Error in special names (columns, tables) #1567

Closed mkgrgis closed 7 months ago

mkgrgis commented 1 year ago

Oracle 12, UTF-8 Postgresql 14, UTF-8 ora2pg 23.2 PRESERVE_CASE 1

Oracle A tables with special signs or/and with "." in names or names of column translated to PostgreSQL not correct.

CREATE TABLE "TECHEXPRO"."⚙ parametres" ("Id" int, "Class1.p0" number(9,3), "Class1.p1" number(9,3), "Class2.p0" number(9,3), "Class2.p1" number(9,3), "Class2.p3" number(9,3), "Class3.p0" number(9,3) )

For example "Class1.p0" have translated to "Class1"."p0". It seems haven't correct translated at all.

darold commented 1 year ago

Ora2Pg do not support dot in object name. This is something I have never encountered and might be very rare so I have not spend time on this until now and will not for the moment.

mkgrgis commented 1 year ago

Thanks, @darold! Let's dot in names will be enhancement. If there is hard regular expressions, maybe https://www.debuggex.com can help you.

darold commented 1 year ago

@mkgrgis I think that this link https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request could help more to have this enhancement.

mkgrgis commented 1 year ago

Thanks @darold !

I am studying Perl (after JavaScript and C experience) and have some URLs of closed issues with problems with object names. Hence some "key lines" are visible for me. I think this will enough to draft, testing and PR to your mainstream. I am beginning from https://github.com/darold/ora2pg/commit/7f740711f1aa05553b71bcedbfeb4d59bb342f9a and https://github.com/darold/ora2pg/commit/e9270809a293ac3c90733f4927b44353d8c915bd

Thanks for many years of developing of this usefully open source utility!

darold commented 7 months ago

Ora2Pg rename all columns with a dot in the name by replacing them with underscore. The new name is appended to the REPLACE_COLS configuration directive value.