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

DROP_FKEY happens even during --oracle_speed, when >1 table #1702

Closed johnrtian closed 4 months ago

johnrtian commented 8 months ago

I'm on ora2pg v24.1.

I don't have a consequence-free PG environment to test this against so I don't know the true scope, but if I specify:

I get the following error:

[2023-10-16 10:01:55] [========================>] 2/2 tables (100.0%) end of scanning.                                               
Can't call method "do" on an undefined value at /usr/local/share/perl5/Ora2Pg.pm line 9082.                                          
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Oracle::db handle DEV at /usr/local/share/perl5/Ora2Pg.pm line 9081.

For v24.1, line 9082 is in the drop_fkey loop: #9082

This doesn't happen when only specifying a single table via -a.

Seems undesirable for FKs to be dropped in PG when using --oracle_speed only.

darold commented 8 months ago

Commit 7d95e23 should fix this issue. Please confirm.

johnrtian commented 8 months ago

Unfortunately, I don't have the means to test a specific build at the moment, and I'm not particularly familiar with Perl. But those changes seem reasonable to me. Thank you!