Обсуждение: Disable FK constarints

Поиск
Список
Период
Сортировка

Disable FK constarints

От
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...



Re: Disable FK constarints

От
Tom Lane
Дата:
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