Re: surprising trigger/foreign key interaction - Mailing list pgsql-hackers

From Tom Lane
Subject Re: surprising trigger/foreign key interaction
Date
Msg-id 10535.1250113755@sss.pgh.pa.us
Whole thread Raw
In response to surprising trigger/foreign key interaction  (Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>)
Responses Re: surprising trigger/foreign key interaction  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:
> the "surprise" here was that the delete is getting silently surpressed 
> even though the original Qual still holds and afaik should result in the 
> row deleted.

The delete from foo acts first (since you put it in a BEFORE trigger).
After the trigger comes back, the outer delete finds itself trying
to delete a row that was already updated by a later-starting command in
the same transaction.  So it doesn't do anything to that row (cf the
HeapTupleSelfUpdated cases in execMain.c).  I think this is documented
someplace but don't remember where.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Pierre Frédéric Caillaud
Date:
Subject: Re: COPY speedup
Next
From: Alvaro Herrera
Date:
Subject: schemapg.h