Re: how to temporally disable foreign key constraint check

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: how to temporally disable foreign key constraint check
Дата
Msg-id j7s8m5$nl0$1@dough.gmane.org
обсуждение исходный текст
Ответ на how to temporally disable foreign key constraint check  (Emi Lu <emilu@encs.concordia.ca>)
Список pgsql-sql
Emi Lu wrote on 21.10.2011 15:36:
> Good morning,
>
>
> Is there a way to temporally disabled foreign key constraints something like
>
> SET FOREIGN_KEY_CHECKS=0
>
> When population is done, will set FOREIGN_KEY_CHECKS=1
>
> Thanks a lot!
> Emi
>
You can define the FKs as "DEFERRABLE INITIALLY IMMEDIATE".

Then at the start of your transaction you can defer constraint checking until you commit everything using:

SET CONSTRAINTS ALL DEFERRED;

Thomas




В списке pgsql-sql по дате отправления:

Предыдущее
От: Emi Lu
Дата:
Сообщение: Re: how to temporally disable foreign key constraint check
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: how to temporally disable foreign key constraint check