Re: Foreign key trigger timing bug?

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Foreign key trigger timing bug?
Date: 2005-12-09 00:20:59
Message-ID: 20051208161849.T64366@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 8 Dec 2005, Jan Wieck wrote:

> On 12/7/2005 4:50 PM, Stephan Szabo wrote:
>
> > On Wed, 7 Dec 2005, Bruce Momjian wrote:
> >
> >> I had an open 8.1 item that was:
> >>
> >> o fix foreign trigger timing issue
> >>
> >> Would someone supply text for a TODO entry on this, as I don't think we
> >> fixed it in 8.1.
> >
> > I'd split this into two separate items now.
> >
> > Fix before delete triggers on cascaded deletes to run after the cascaded
> > delete is done. This is odd, but seems to be what the spec requires.
>
> Ugh, that sounds ugly.

Yeah. I really don't understand it, but it appears to me to be explicitly
different in the spec for on delete cascade even compared to the rest of
the referential actions.

> One problem I see is, what do we do if the BEFORE
> trigger then returns NULL (to skip the delete). The cascaded operations
> are already done. Do we have to execute the cascaded deletes in a
> subtransaction or do we disallow the skip in this case?

I think we'd have disallow skipping. Especially since skipping would
probably end up with a violated constraint.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-12-09 01:26:45 Re: generic builtin functions
Previous Message Gavin Sherry 2005-12-08 23:08:40 Another encoding issue