From: Tom Lane <tgl@sss.pgh.pa.us>
To: Denis Zaitsev <zzz@anda.ru>
Cc: pgsql-sql@postgresql.org
Subject: Re: Nonexistent NEW relation in some places of rules
Date: Tue, 29 Jul 2003 18:32:44 -0400
Message-ID: <5035.1059517964@sss.pgh.pa.us> (raw)
In-Reply-To: <20030730033328.B4870@natasha.ward.six>
References: <20030730033328.B4870@natasha.ward.six>
Denis Zaitsev <zzz@anda.ru> writes:
> create rule b as
> on insert to b do instead
> insert into a
> select * from produce (new.b);
> ERROR: Relation "*NEW*" does not exist
> So, what is wrong in using NEW right from the FROM?
CVS tip gives a possibly more helpful error message:
ERROR: function expression in FROM may not refer to other relations of same query level
The problem is that the rule gets expanded into something rather like
insert into a select ... from new, produce(new.b);
and we can't support that. If we ever add support for SQL99's
LATERAL(), it might help improve matters.
regards, tom lane
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: tgl@sss.pgh.pa.us, zzz@anda.ru
Subject: Re: Nonexistent NEW relation in some places of rules
In-Reply-To: <5035.1059517964@sss.pgh.pa.us>
* 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