Skip site navigation (1) Skip section navigation (2)

Re: ON DELETE SET NULL clauses do error when more than two columns are referenced to one table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: ON DELETE SET NULL clauses do error when more than two columns are referenced to one table
Date: 2007-08-13 14:44:22
Message-ID: 5863.1187016262@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
> I'm not sure what to do about this. We could change the order the
> triggers are fired to breadth-first. If all the setnull triggers were
> executed first, there would be no problem. But that seems like a pretty
> big change, and I'm afraid it might have other unintended consequences.

I think it's not so much that they should be "breadth first" as that the
updates generated by the triggers shouldn't count as their own
sub-statements.  The trigger events generated by those updates need to
go at the end of the outer statement's trigger queue.  We'll need to
change the API of SPI_execute_snapshot for this, but since that's only
for the use of the RI triggers anyway, it doesn't seem like a problem.

I also notice that only one of the
afterTriggerMarkEvents/afterTriggerInvokeEvents pairs in trigger.c
is coded as a "while" ... they probably all must be if we expect that RI
triggers will generate events at the same trigger level.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Heikki LinnakangasDate: 2007-08-14 18:55:38
Subject: Re: ON DELETE SET NULL clauses do error when more than two columns are referenced to one table
Previous:From: Brian HirtDate: 2007-08-13 13:43:26
Subject: Re: failed to re-find parent key in "..." for deletion target page

pgsql-patches by date

Next:From: Bruce MomjianDate: 2007-08-14 04:00:34
Subject: Re: [HACKERS] Function structure in formatting.c
Previous:From: Gregory StarkDate: 2007-08-13 13:10:40
Subject: Re: ON DELETE SET NULL clauses do error when more than two columns are referenced to one table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group