Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Дата
Msg-id 11890.1292196052@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Robert Haas <robertmhaas@gmail.com>)
Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Nicolas Barbier <nicolas.barbier@gmail.com>)
Список pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> On Sun, 2010-12-12 at 17:57 -0500, Tom Lane wrote:
>> Huh?  It allows you to postpone the check until commit.  That's far from
>> not enforcing it.

> This clearly implies that un-enforced constraints are not checked at
> commit.

[ shrug... ]  I can't argue with you about what may or may not be in an
unpublished draft of an unratified version of the standard, since I
don't have a copy.  But allow me to harbor doubts that they really
intend to allow someone to force a constraint to be considered valid
without any verification.  This proposal strikes me as something mysql
would do, not the standards committee.  (In particular, can a constraint
go from not-enforced to enforced state without getting checked at that
time?)

Even if you're reading the draft correctly, and the wording makes it
into a released standard, the implementation you propose would break our
code.  The incremental FK checks are designed on the assumption that the
constraint condition held before; they aren't likely to behave very
sanely if the data is bad.  I'd want to see a whole lot more analysis of
the resulting behavior before even considering an idea like this.
        regards, tom lane


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Problem with pg_upgrade (8.4 -> 9.0) due to ALTER DATABASE SET ROLE
Следующее
От: Robert Haas
Дата:
Сообщение: Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED