Tom Lane wrote:
> I've found a problem with the VALUES-as-RTE approach:
>
> regression=# create table src(f1 int, f2 int);
> CREATE TABLE
> regression=# create table log(f1 int, f2 int, tag text);
> CREATE TABLE
> regression=# insert into src values(1,2);
> INSERT 0 1
> regression=# create rule r2 as on update to src do
> regression-# insert into log values(old.*, 'old'), (new.*, 'new');
> CREATE RULE
> regression=# update src set f2 = f2 + 1;
> server closed the connection unexpectedly
Does it work if you do
regression=# create rule r2 as on update to src do
regression-# insert into log values(old.f1, old.f2, 'old'), (new.f1, new.f2, 'new');
?
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support