Re: disabling constraints

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: disabling constraints
Дата
Msg-id 29453.1099600592@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: disabling constraints  (Vivek Khera <khera@kcilink.com>)
Список 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

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

Предыдущее
От: "David Parker"
Дата:
Сообщение: Re: disabling constraints
Следующее
От: Timothy Perrigo
Дата:
Сообщение: Re: PostgreSQL on Linux PC vs MacOS X