Re: Fwd: [NOVICE] Trigger and Recursive Relation ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Fwd: [NOVICE] Trigger and Recursive Relation ?
Дата
Msg-id 20877.1154555244@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Fwd: [NOVICE] Trigger and Recursive Relation ?  ("Nikolay Samokhvalov" <samokhvalov@gmail.com>)
Список pgsql-bugs
"Nikolay Samokhvalov" <samokhvalov@gmail.com> writes:
> I don't understand how this can be called "not bug"... Please, help me
> understand it :-)

The situation is that the DELETE arrives at a row after the trigger has
already UPDATEd that row.  You could make a reasonable case for throwing
an error in this situation, but what we choose to do is assume that the
trigger's action is correct.  The row version that the DELETE would have
acted on no longer "exists", so I don't really see that this violates the
spec (bearing in mind that the spec doesn't know what MVCC is).

I think the subtext of your complaint is that you'd like the DELETE to
be applied to the updated row, but that doesn't hold any more water than
what we do now.  Consider the opposite case where the outer query is an
UPDATE and the trigger DELETEs a row that the outer query will reach
later --- it certainly isn't going to make sense to un-delete the row
so we can update it.  The only sensible choices here are to throw an
error or do nothing.

            regards, tom lane

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

Предыдущее
От: "Nikolay Samokhvalov"
Дата:
Сообщение: Re: Fwd: [NOVICE] Trigger and Recursive Relation ?
Следующее
От: Brian Hurt
Дата:
Сообщение: Re: BUG #2561: Manual is wrong: You can't grant a group to