From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Vivek Khera <khera(at)kcilink(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: disabling constraints |
Date: | 2004-11-04 20:36:32 |
Message-ID: | 29453.1099600592@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Vivek Khera <khera(at)kcilink(dot)com> writes:
> "DP" == David Parker <dparker(at)tazznetworks(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | David Parker | 2004-11-04 20:38:58 | Re: disabling constraints |
Previous Message | Timothy Perrigo | 2004-11-04 20:35:26 | Re: PostgreSQL on Linux PC vs MacOS X |