Re: surprising trigger/foreign key interaction

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: surprising trigger/foreign key interaction
Date: 2009-08-12 21:49:15
Message-ID: 10535.1250113755@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-12 21:57:34 Re: Why is vacuum_freeze_min_age 100m?
Previous Message Kevin Grittner 2009-08-12 21:33:44 Re: Why is vacuum_freeze_min_age 100m?