Load data into PostgreSQL fails with foreign key constraint

536 Views Asked by At

I am loading data into Postgresql using ora2pg tool by following command

C:\ora2pg-23.1>ora2pg -t COPY -o data.sql -b F:\otopg\NCP\PG_Data -c C:\ora2pg\ora2pg.conf
[========================>] 256/256 tables (100.0%) end of scanning.

SET client_encoding TO 'UTF8';
SET synchronous_commit TO off;

DBD::Pg::db pg_putcopyend failed: ERROR: insert or update on table "attribute" violates foreign key constraint "fk2_attibute" DETAIL: Key (attribute_category_id)=(2) is not present in table "attribute_category". at C:/Strawberry/perl/site/lib/Ora2Pg.pm line 14716. FATAL: ERROR: insert or update on table "attribute" violates foreign key constraint "fk2_attibute" DETAIL: Key (attribute_category_id)=(2) is not present in table "attribute_category". Aborting export...

I am trying to run some queries to disable trigger but it's not working

ALTER TABLE attribute_category DISABLE TRIGGER ALL;
ALTER TABLE attribute DISABLE TRIGGER ALL;
ALTER TABLE category DISABLE TRIGGER ALL;

permission denied: "RI_ConstraintTrigger_a_19295" is a system trigger

Total execution time: 00:00:00.218

SET CONSTRAINTS ALL DEFERRED This works but same error in loading

Also set session_replication_role to replica; does not work because admin login can not be superuser

Can some expert help here. Thanks in advance

0

There are 0 best solutions below