Re: problem with rules - column values lost - Mailing list pgsql-hackers

From Tom Lane
Subject Re: problem with rules - column values lost
Date
Msg-id 3141.1111907368@sss.pgh.pa.us
Whole thread Raw
In response to problem with rules - column values lost  (Daniel Schuchardt <daniel_schuchardt@web.de>)
List pgsql-hackers
Daniel Schuchardt <daniel_schuchardt@web.de> writes:
> there seem to be a bug in the 8.0 Rule System if I update a view and 
> does not give a column an value.

You can't seriously expect that example to work.  The DELETE removes the
row that lang_abzu() needs to have in order to yield a non-null result,
and so the reference to new.abz_txt in the next line yields a null.

new.* and old.* in rules are macros; they don't represent some sort of
internally held data, but re-evaluations of the relevant definitions.
In particular, new.abz_txt in the last line of the rule references
the view definition if the invoking UPDATE didn't specify any particular
new value for the column.

It might be that you could get the effect you want with triggers ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Daniel Schuchardt
Date:
Subject: problem with rules - column values lost
Next
From: Michael Fuhr
Date:
Subject: Re: i want to find