Disable FK constarints

Started by Nonameabout 20 years ago2 messagesgeneral
Jump to latest
#1Noname
Prestation3.EXPLOITATION@nexans.com

Hi,

I try to load an entire database ( from Oracle via ora2pg )
create table is OK
there are some FK's in the database

I did insert's with :
BEGIN TRANSACTION;
SET CONSTRAINTS ALL DEFERRED;
insert ...
END TRANSACTION;

I get:
ERROR: insert or update on table "transactions" violates foreign key
constraint

How can I get rid off the FK CONSTRAINTS during the load ???

Thanks in advance...

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: Disable FK constarints

Prestation3.EXPLOITATION@nexans.com writes:

I did insert's with :
BEGIN TRANSACTION;
SET CONSTRAINTS ALL DEFERRED;
insert ...
END TRANSACTION;

I get:
ERROR: insert or update on table "transactions" violates foreign key
constraint

SET CONSTRAINTS only affects those constraints that are marked
DEFERRABLE, which I believe is not the default.

regards, tom lane