Re: Cascading deletes with rules in 7.0.3: why doesn't this work?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeremy Radlow <jtr(at)sourcerers(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Cascading deletes with rules in 7.0.3: why doesn't this work?
Date: 2001-04-02 14:37:27
Message-ID: 7776.986222247@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeremy Radlow <jtr(at)sourcerers(dot)com> writes:
> In the following example, I'm trying to log all deletions from any of three
> tables. The only information I'm interested in recording is the index from
> table A which the deleted row referenced.

This seems to be a bug. I haven't finished tracking it down yet, but
when you delete from A or B, the ON DELETE CASCADE trigger is going to
try to delete from B and/or C as well --- so the trigger will end up
invoking the ON DELETE rules for those tables and hence trying to insert
into delete_log. This chain of events does indeed happen as expected,
but it seems that when we get down to the INSERT, the value being passed
for old.ax has become NULL. Something rotten in parameter passing,
apparently. (Deletion from C works, because that does not trigger any
cascaded deletes.)

Thanks for the report! I'll try to fix it for 7.1...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Lohse 2001-04-02 14:46:06 bitwise again
Previous Message Tom Lane 2001-04-02 14:21:34 Re: function to operate on same fields, different records?