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 E98FF30F5F5 for ; Sun, 22 Jun 2003 20:28:23 +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 72460-06 for ; Sun, 22 Jun 2003 17:28:13 -0300 (ADT) Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by svr1.postgresql.org (Postfix) with SMTP id E5EEA30F5B9 for ; Sun, 22 Jun 2003 17:28:12 -0300 (ADT) Received: (qmail 30400 invoked by uid 0); 22 Jun 2003 20:28:12 -0000 Date: Sun, 22 Jun 2003 22:28:12 +0200 (MEST) From: Gunter Diehl To: pgsql-sql@postgresql.org MIME-Version: 1.0 Subject: Rules: passing new/old to functions X-Priority: 3 (Normal) X-Authenticated-Sender: #0012206503@gmx.net X-Authenticated-IP: [217.184.170.56] Message-ID: <11362.1056313692@www59.gmx.net> X-Mailer: WWW-Mail 1.6 (Global Message Exchange) X-Flags: 0001 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200306/301 X-Sequence-Number: 14059 How to pass the special variables new / old to functions? e.g. I'd like to to something like this (v is a view): 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. using: select f(new) from new doesn't work either: pg says relation new doesn't exist. Since I need to handle tables with more than 20 columns, it would be uggly if I had to pass every single value to the function as follows: select f1(new.1, ..., new.n, old.1, ..., old.n) create function f1(typeof 1, ..., typeof n, typeof 1, ..., typeofn) I'd be glad for any kind of suggestion. regards, Gunter -- +++ GMX - Mail, Messaging & more http://www.gmx.net +++ Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!