Re: ALTER TABLE ... IF EXISTS feature?

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: ALTER TABLE ... IF EXISTS feature?
Дата
Msg-id
1242.1288989107@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Tom Lane <tgl@sss.pgh.pa.us>
Re: ALTER TABLE ... IF EXISTS feature? Robert Haas <robertmhaas@gmail.com>
Re: ALTER TABLE ... IF EXISTS feature? Tom Lane <tgl@sss.pgh.pa.us>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Tom Lane <tgl@sss.pgh.pa.us>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Tom Lane <tgl@sss.pgh.pa.us>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Tom Lane <tgl@sss.pgh.pa.us>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Robert Haas <robertmhaas@gmail.com>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Robert Haas <robertmhaas@gmail.com>
Re: ALTER TABLE ... IF EXISTS feature? Bruce Momjian <bruce@momjian.us>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Bruce Momjian <bruce@momjian.us>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Bruce Momjian <bruce@momjian.us>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Bruce Momjian <bruce@momjian.us>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Re: ALTER TABLE ... IF EXISTS feature? Daniel Farina <drfarina@acm.org>
Daniel Farina  writes:
> On Fri, Nov 5, 2010 at 11:04 AM, Tom Lane  wrote:
>> Daniel Farina  writes:
>>> pg_dump --clean will successfully and silently wipe out a foreign key
>>> right now, should it exist,
>> 
>> No, it will not, because we don't use CASCADE in the drop commands.

> I know it does not use CASCADE, but if I understand it correctly,
> foreign keys are dropped between tables, and then the tables are
> dropped. (effectively a manual cascade)

You're missing the point.  The scenario I'm concerned about is:
source database contained table foo
target database contains table foo, and table bar, andbar has an FK reference to foo

The FK constraint is not known to pg_dump, and therefore there will not
be a DROP CONSTRAINT for it in the dump.  So the DROP on the referenced
table will fail.  The only way we could make it succeed would be to use
CASCADE, which we don't do specifically because this sort of thing seems
quite unsafe.
		regards, tom lane

В списке pgsql-hackers по дате отправления
От: David E. Wheeler
Дата:
Сообщение: Query Plan Columns
От: Andrew Dunstan
Дата:
Сообщение: Re: Query Plan Columns
FAQ