Re: BUG #3296: CASCADING FKs dont DEFER

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #3296: CASCADING FKs dont DEFER
Дата
Msg-id 12066.1179842269@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #3296: CASCADING FKs dont DEFER  ("S. Robert James" <srobertjames@vesaria.com>)
Список pgsql-bugs
"S. Robert James" <srobertjames@vesaria.com> writes:
> If a FK is set to ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, it does
> not honor the defer.

> That is, if you DELETE a record and then INSERT it back, you still get a FK
> deletion of the referencing record.  This seems to ignore DEFERRED.

Actually, the cascaded delete happens immediately regardless of "defer"
mode; you can only defer constraint checks, not cascade actions.  As far
as I can tell, this is the behavior defined by the SQL spec.  Notice in
particular this statement (from SQL92 11.8 <referential constraint
definition>)

         9) All rows that are marked for deletion are effectively deleted
            at the end of the SQL-statement, prior to the checking of any
            integrity constraints.

which makes it clear that the committee thinks that cascade deletes are
separate from constraint checks.

            regards, tom lane

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

Предыдущее
От: adam terrey
Дата:
Сообщение: Inconsistant SQL results - Suspected error with query planing or query optimisation.
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: ON DELETE CASCADE with multiple paths