Re: BUG #4396: Trigger event fired "UPDATE" when "DELETE" happening via foreign key

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #4396: Trigger event fired "UPDATE" when "DELETE" happening via foreign key
Дата
Msg-id 26811.1220461733@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #4396: Trigger event fired "UPDATE" when "DELETE" happening via foreign key  ("Stephen Cuppett" <stephen.cuppett@sas.com>)
Ответы Re: BUG #4396: Trigger event fired "UPDATE" when "DELETE" happening via foreign key  (Stephen Cuppett <Stephen.Cuppett@sas.com>)
Список pgsql-bugs
Stephen Cuppett <Stephen.Cuppett@sas.com> writes:
> When A is deleted, B is deleted, E is set null.  Then, D is deleted and E is deleted.

> FOR EVERY ROW AFTER UPDATE is run on E for rows that no longer exist.

> Not sure if that's a bug or not... not sure it would be undesirable under conditions for that not to run for those
tuplesthat are already gone. 

Well, not firing the trigger would be pretty bad in some cases too.  For
instance if you're trying to log updates in a history table, you'd not
want to miss updates just because they were immediately obsoleted.

Looking again at your example, that's exactly what your trigger is
doing, isn't it?  Why in the world has your history table got an FK
back to the live tables?  That presumes that you'll never delete any
objects ... or that you're willing to lose all history about them
as soon as they're deleted, which seems a pretty odd choice.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4397: crash in tab-complete.c
Следующее
От: Stephen Cuppett
Дата:
Сообщение: Re: BUG #4396: Trigger event fired "UPDATE" when "DELETE" happening via foreign key