ora2pg icon indicating copy to clipboard operation
ora2pg copied to clipboard

DROP_FKEY not working

Open jsheelam29 opened this issue 8 months ago • 2 comments

Ora2Pg v24.3 Oracle - 19.26 PostgreSQL - 16.8

I have set DROP_FKEY to 1 in config file, Foreign key is in deferred state in the database as below.

   schema   |    table     |        constraint        | constraint-type | deferrable | deferred
------------+--------------+--------------------------+-----------------+------------+----------
 bnkrpt_obj | alias        | alias_ali_id_pk          | p               | f          | f
 bnkrpt_obj | employer     | employer_emplr_id_pk     | p               | f          | f
 **bnkrpt_obj | filing       | filing_fil_emplr_id_fk   | f               | t          | t**
 bnkrpt_obj | filing       | filing_fil_id_pk         | p               | f          | f
 bnkrpt_obj | lu_chapter   | lu_chapter_chapt_code_pk | p               | f          | f
 bnkrpt_obj | lu_district  | lu_district_dist_code_pk | p               | f          | f
 bnkrpt_obj | lu_qualifier | lu_qualifier_pk          | p               | f          | f
(7 rows)

But still direct import is failing as below.

SET client_encoding TO 'UTF8';
SET synchronous_commit TO off;
SET search_path = bnkrpt_obj,public;

FATAL: ERROR:  insert or update on table "filing" violates foreign key constraint "filing_fil_emplr_id_fk"
DETAIL:  Key (fil_emplr_id)=(6932) is not present in table "employer".
DBI::db=HASH(0x5586fc1c1390)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting) at /usr/local/share/perl5/Ora2Pg.pm line 15510.
Aborting export...
FATAL: ERROR:  insert or update on table "filing" violates foreign key constraint "filing_fil_emplr_id_fk"
DETAIL:  Key (fil_emplr_id)=(15028) is not present in table "employer".
Aborting export...

jsheelam29 avatar Apr 07 '25 18:04 jsheelam29

Are you using direct data import or output to file?

darold avatar Apr 12 '25 07:04 darold

Gilles, Thanks for looking into it.

I am using direct import.

jsheelam29 avatar Apr 14 '25 12:04 jsheelam29