Re: Temporally disabled foreign key constraint check? - Mailing list pgsql-general

From raghu ram
Subject Re: Temporally disabled foreign key constraint check?
Date
Msg-id CALnrrJS9Lv-6fa5Z43CJcaoQJ6ybUMuCiDatTpCnRnpHckBadA@mail.gmail.com
Whole thread Raw
In response to Temporally disabled foreign key constraint check?  (Emi Lu <emilu@encs.concordia.ca>)
Responses Re: Temporally disabled foreign key constraint check?  (Andreas Kretschmer <akretschmer@spamfence.net>)
Re: Temporally disabled foreign key constraint check?  (Emi Lu <emilu@encs.concordia.ca>)
List pgsql-general


On Fri, Oct 21, 2011 at 8:33 PM, Emi Lu <emilu@encs.concordia.ca> wrote:
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


You can disable *triggers* on a table (which will disable all the FK constraints, but not things like 'not nul' or 'unique').

For Disable:

update pg_class set reltriggers=0 where relname = 'TEST';

For Enable:

update pg_class set reltriggers = count(*) from pg_trigger where pg_class.oid=tgrelid and relname='TEST';

 
--Raghu 

pgsql-general by date:

Previous
From: Emi Lu
Date:
Subject: Temporally disabled foreign key constraint check?
Next
From: Andreas Kretschmer
Date:
Subject: Re: Temporally disabled foreign key constraint check?