X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 76A8DD1DC7D for ; Mon, 19 Apr 2004 23:25:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07187-09 for ; Mon, 19 Apr 2004 23:25:15 -0300 (ADT) Received: from ganymede.hub.org (u46n208.hfx.eastlink.ca [24.222.46.208]) by svr1.postgresql.org (Postfix) with ESMTP id D594FD1DB5D for ; Mon, 19 Apr 2004 23:25:10 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id A3A68342A4; Mon, 19 Apr 2004 23:25:14 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 93EE434293 for ; Mon, 19 Apr 2004 23:25:14 -0300 (ADT) X-Received: from localhost ([unix socket]) by ganymede.hub.org (Cyrus v2.2.3) with LMTP; Mon, 19 Apr 2004 16:40:10 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id D037E3586A for ; Mon, 19 Apr 2004 16:01:33 -0300 (ADT) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5) for scrappy@localhost (single-drop); Mon, 19 Apr 2004 16:01:33 -0300 (ADT) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.3) with LMTP; Mon, 19 Apr 2004 15:59:16 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 79C81D1E96D for ; Mon, 19 Apr 2004 15:59:16 -0300 (ADT) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55914-09 for ; Mon, 19 Apr 2004 15:59:11 -0300 (ADT) X-Received: from martin.sysdetect.com (martin.sysdetect.com [65.209.102.1]) by svr1.postgresql.org (Postfix) with ESMTP id 4611DD1E94C for ; Mon, 19 Apr 2004 15:59:09 -0300 (ADT) X-Received: (from mail@localhost) by martin.sysdetect.com (8.11.4/8.11.3) id i3JIxAA25679 for ; Mon, 19 Apr 2004 18:59:10 GMT X-Received: from winwood.sysdetect.com(172.16.1.1) via SMTP by mail.sysdetect.com, id smtpdEtC150; Mon Apr 19 18:59:08 2004 X-Received: from sysd.com (thriller.sysdetect.com [172.16.1.33]) by winwood.sysdetect.com (8.11.6/8.11.6) with ESMTP id i3JIx8b09653 for ; Mon, 19 Apr 2004 14:59:08 -0400 Message-ID: <4084217C.2040300@sysd.com> Date: Mon, 19 Apr 2004 14:59:08 -0400 From: Rich Cullingford User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703 X-Accept-Language: en-us, en MIME-Version: 1.0 To: psql-interfaces@postgresql.org Subject: Passing NEW to functions inside a trigger function... Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-DCC: : X-Spam-Pyzor: ReSent-Date: Mon, 19 Apr 2004 23:25:09 -0300 (ADT) Resent-From: "Marc G. Fournier" Resent-To: pgsql-interfaces@postgresql.org ReSent-Subject: Passing NEW to functions inside a trigger function... ReSent-Message-ID: <20040419232509.B780@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/38 X-Sequence-Number: 4859 All, I'm unable to find this question addressed in the archive, tho' it seems rather obvious. One often needs to dispatch on different subsets of the data in NEW inside a PLPGSQL trigger function. It would be most convenient to just pass NEW itself (or NEW.*) to the function thus called, but there doesn't seem to be any way to do that. Any use of NEW inside a function call imbedded in the trigger function, whether in a SELECT INTO, EXECUTE or PERFORM, leads to a: ERROR: NEW used in query that is not in a rule (or sometimes "relation NEW not found.") I've seen syntax for passing a row of data in ordinary functions, but not inside triggers. Any enlightenment appreciated! Rich Cullingford rculling@sysd.com