X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9BBC3D1C976 for ; Tue, 29 Jul 2003 21:36:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 00542-07 for ; Tue, 29 Jul 2003 18:35:44 -0300 (ADT) Received: from ward.six (unknown [212.57.173.234]) by svr1.postgresql.org (Postfix) with ESMTP id C79DED1C973 for ; Tue, 29 Jul 2003 18:36:38 -0300 (ADT) Date: Wed, 30 Jul 2003 03:33:28 +0600 From: Denis Zaitsev To: pgsql-sql@postgresql.org Subject: Nonexistent NEW relation in some places of rules Message-ID: <20030730033328.B4870@natasha.ward.six> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/435 X-Sequence-Number: 14549 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 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.