Re: problem with rules - column values lost

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Schuchardt <daniel_schuchardt(at)web(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: problem with rules - column values lost
Date: 2005-03-27 07:09:28
Message-ID: 3141.1111907368@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Schuchardt <daniel_schuchardt(at)web(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2005-03-27 07:09:58 Re: i want to find
Previous Message Qingqing Zhou 2005-03-27 05:26:53 Re: Postgres recoverey for deleted row of data