X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id AA58930FF80 for ; Fri, 27 Jun 2003 03:49:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 77919-04 for ; Fri, 27 Jun 2003 00:49:29 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 718A031004D for ; Fri, 27 Jun 2003 00:49:26 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h5R3nMQQ024558; Thu, 26 Jun 2003 23:49:22 -0400 (EDT) To: Gunter Diehl Cc: pgsql-sql@postgresql.org Subject: Re: Rules: passing new/old to functions In-reply-to: <11362.1056313692@www59.gmx.net> References: <11362.1056313692@www59.gmx.net> Comments: In-reply-to Gunter Diehl message dated "Sun, 22 Jun 2003 22:28:12 +0200" Date: Thu, 26 Jun 2003 23:49:22 -0400 Message-ID: <24557.1056685762@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200306/306 X-Sequence-Number: 14064 Gunter Diehl 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