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.01k stars 342 forks source link

Ora2Pg: bug in export_schema.sh/ps1: -p argument value (plsql to pgsql) #1580

Closed elexus closed 1 year ago

elexus commented 1 year ago

Hi, Darold! I think, that the purpose of second "for" loop in export_schema.sh/ps1 scripts was to export original oracle sql code. In furst "for" loop you directly write -p parameter, in second loop you don't, so it should export original code. BUT if in config file this parameter is set to 1, it will export and modify to pgsql code twise.

Maybe it's a good idea to give an ability to specify this parameter value (not only if -p exist, so it's true), but give an ability to specify force FALSE value, like ora2pg -p 0 -t $etype -o $ltype.sql -b $namespace/sources/${ltype}s -c $namespace/config/ora2pg.conf

I mean that this loop shoudn't convert plsql to pgsql even if in config value is 1. And we can't force this value to 0 through script.

darold commented 1 year ago

The solution is to not enable the directive in the config file, ora2pg --init_project take care of that, if it is changed later you have the behavior of these changes.