Re: disabling constraints
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vivek Khera <khera@kcilink.com>
Cc: pgsql-general@postgresql.org
Date: 2004-11-04T20:36:32Z
Lists: pgsql-general
Vivek Khera <khera@kcilink.com> writes: > "DP" == David Parker <dparker@tazznetworks.com> writes: > DP> I would like to be able to truncate all of the tables in a schema > DP> without worrying about FK constraints. I tried issuing a "SET > DP> CONSTRAINTS ALL DEFERRED" before truncating, but I still get > DP> constraint errors. Is there a way to do something like: > Why don't you truncate your tables in an order that won't violate > FK's? Or do you have circular references? The TRUNCATE command just says "no" if it sees any FKs pointing at the target table; order doesn't matter. It might be an interesting future extension to allow truncating multiple tables in a single command, whereupon we could ignore FKs linking two such tables. regards, tom lane