Re: Foreign key trigger timing bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Jan Wieck <JanWieck(at)Yahoo(dot)com>, 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 01:53:33
Message-ID: 5768.1134093213@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> 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.

That seems to me to be a sufficient reason to not follow the spec in
this respect. A BEFORE trigger should be run BEFORE anything happens,
full stop. I can't think of any good reason why the spec's semantics
are better. (It's not like our triggers are exactly spec-compatible
anyway.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Qingqing Zhou 2005-12-09 04:07:38 Warm-cache prefetching
Previous Message Tom Lane 2005-12-09 01:50:39 Re: Another encoding issue