Nonexistent NEW relation in some places of rules

From: Denis Zaitsev <zzz(at)anda(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject: Nonexistent NEW relation in some places of rules
Date: 2003-07-29 21:33:28
Message-ID: 20030730033328.B4870@natasha.ward.six
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

In general, the task I'm trying to solve is to make a multiply inserts
for a table on the one only insert for a view. It should be noted
about the method of producing these multiply rows, that they depend on
the VALUES given to that <top level> INSERT. So, the trivialized
schema is:

create function produce (text) returns setof text
language plpgsql
as '
begin
return next $1||1;
return next $1||2;
return next $1||3;
return;
end;
';

create table a (a text);

create view b as
select a as b
from a;

create rule b as
on insert to b do instead
insert into a
select * from produce (new.b);

And I get

psql:zhoppa.sql:21: ERROR: Relation "*NEW*" does not exist

when I feed this to psql...

So, what is wrong in using NEW right from the FROM?

Thanks in advance.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Denis Zaitsev 2003-07-29 22:05:14 Re: Very strange 'now' behaviour in nested triggers.
Previous Message ww zz 2003-07-29 20:46:44 Unsubscribe