Re: BUG #6123: DELETE fails if before trigger causes another trigger to UPDATE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #6123: DELETE fails if before trigger causes another trigger to UPDATE
Дата
Msg-id 11540.1311113441@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #6123: DELETE fails if before trigger causes another trigger to UPDATE  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: BUG #6123: DELETE fails if before trigger causes another trigger to UPDATE  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-bugs
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> The update causes the already-selected target row version of the
>> DELETE to be obsoleted, so heap_delete finds it has nothing to do.
>> I'm disinclined to mess with that logic.

> It's pretty astonishing behavior for application programmers.  It's
> not unusual for triggers on detail from one table to maintain a
> status, count, or sum in a higher level table.  When a DELETE from
> the higher level table causes deletes at the lower level, the lower
> level trigger really doesn't have any way to know that.  I think
> this should be considered a bug.

I think you have no idea how large a can of worms you're opening.

To point out just one problem, if heap_delete restarts itself and tries
to delete some other row version than it started with, should the ON
DELETE triggers be fired again?  If not, why not?  If they are, what
prevents an infinite loop?

IMO, application code that causes this to happen is impossibly fragile
and needs to be rewritten to not do it.

            regards, tom lane

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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: BUG #6123: DELETE fails if before trigger causes another trigger to UPDATE
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: BUG #6123: DELETE fails if before trigger causes another trigger to UPDATE