pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Denis Zaitsev <zzz@anda.ru>
To: pgsql-sql@postgresql.org
Subject: Nonexistent NEW relation in some places of rules
Date: Wed, 30 Jul 2003 03:33:28 +0600
Message-ID: <20030730033328.B4870@natasha.ward.six> (raw)

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.



view thread (3+ messages)  latest in thread

Message-ID: <20030730033328.B4870@natasha.ward.six>
Permalink:  ../20030730033328.B4870@natasha.ward.six/
Also on:    postgresql.org/message-id/20030730033328.B4870@natasha.ward.six

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: zzz@anda.ru
  Subject: Re: Nonexistent NEW relation in some places of rules
  In-Reply-To: <20030730033328.B4870@natasha.ward.six>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox