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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: nikolay(at)samokhvalov(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Fwd: [NOVICE] Trigger and Recursive Relation ?
Date: 2006-08-02 21:47:24
Message-ID: 20877.1154555244@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-novice

"Nikolay Samokhvalov" <samokhvalov(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Wade Klaver 2006-08-03 16:02:57 unsubscribe
Previous Message Nikolay Samokhvalov 2006-08-02 21:06:38 Re: Fwd: [NOVICE] Trigger and Recursive Relation ?

Browse pgsql-novice by date

  From Date Subject
Next Message Paul Silveira 2006-08-03 00:15:39 Re: Is there a gui front end for this wonderful db program
Previous Message Nikolay Samokhvalov 2006-08-02 21:06:38 Re: Fwd: [NOVICE] Trigger and Recursive Relation ?