disabling constraints - Mailing list pgsql-general

From David Parker
Subject disabling constraints
Date
Msg-id 07FDEE0ED7455A48AC42AC2070EDFF7C1492F3@corpsrv2.tazznetworks.com
Whole thread Raw
List pgsql-general
I would like to be able to truncate all of the tables in a schema without worrying about FK constraints. I tried
issuinga "SET CONSTRAINTS ALL DEFERRED" before truncating, but I still get constraint errors. Is there a way to do
somethinglike: 

1) disable all constraints
2) truncate all tables
3) re-enable all constraints

?

In the slony project there is a procedure "altertableforreplication" that appears to do 1), but since it is updating
pg_catalogtables directly, I don't want to cut/paste before I understand what it's doing! 

Is there any "standard" way of doing this?

- DAP
----------------------------------------------------------------------------------
David Parker    Tazz Networks    (401) 709-5130
 

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: compatibilityissues from 7.1 to 7.4
Next
From: Thomas Hallgren
Date:
Subject: Re: Reasoning behind process instead of thread based