Re: DO INSTEAD and conditional rules - Mailing list pgsql-hackers

From Tom Lane
Subject Re: DO INSTEAD and conditional rules
Date
Msg-id 9287.1114539616@sss.pgh.pa.us
Whole thread Raw
In response to Re: DO INSTEAD and conditional rules  (David Wheeler <david@kineticode.com>)
Responses Re: DO INSTEAD and conditional rules
List pgsql-hackers
David Wheeler <david@kineticode.com> writes:
> On Apr 26, 2005, at 8:55 AM, Tom Lane wrote:
>> Well, they handle simple situations OK, but we keep seeing people get
>> burnt as soon as they venture into interesting territory.

> [ snip ]

> Ah, yes, you're right, that is...unexpected. Perhaps OLD can contain 
> its values for the duration of the RULE's statements? I'm assuming that 
> what's happening is that OLD.id is NULL after the first of the two 
> DELETE statements...

The problem is that OLD is effectively a macro for the view, and once
you've deleted one of the rows, that ID is no longer present anywhere in
the view.  Sometimes you can work around this by making the join an
outer join, but that's certainly a kluge.

>> Like I said, I don't have a better idea.  Just a vague feeling of
>> dissatisfaction.

> I'd call it a bug. ;-)

I don't think it's fixable without a fundamental rethinking of the
feature.
        regards, tom lane


pgsql-hackers by date:

Previous
From: David Wheeler
Date:
Subject: Re: DO INSTEAD and conditional rules
Next
From: Rod Taylor
Date:
Subject: pg_restore stuck in a loop?