From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gunter Diehl <gdid@gmx.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Rules: passing new/old to functions
Date: Thu, 26 Jun 2003 23:49:22 -0400
Message-ID: <24557.1056685762@sss.pgh.pa.us> (raw)
In-Reply-To: <11362.1056313692@www59.gmx.net>
References: <11362.1056313692@www59.gmx.net>
Gunter Diehl <gdid@gmx.de> writes:
> create funtion f1(v, v) returns void as '...'
> create rule vupt as on update to v do instead select f1(new, old)
> While accepting this definitions, pg says it can not handle "whole-tuple
> references" at runtime.
FWIW, the "old" case works fine. "new" doesn't work so well because the
new row hasn't been formed into a tuple at the point where the rule
runs; it only exists as a list of variables. (This is a rather handwavy
explanation, but I think it captures the key point.) While this could
probably be fixed with some effort, I doubt it's going to happen soon.
Is there any chance of doing what you want with a trigger instead of a
rule?
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, gdid@gmx.de
Subject: Re: Rules: passing new/old to functions
In-Reply-To: <24557.1056685762@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