X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 6889ECCC17 for ; Fri, 18 Jul 2003 09:03:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 51778-05 for ; Fri, 18 Jul 2003 09:03:44 +0000 (GMT) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by svr1.postgresql.org (Postfix) with ESMTP id 86557CCB30 for ; Fri, 18 Jul 2003 06:03:14 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 19dR9V-00060e-0U; Fri, 18 Jul 2003 10:03:45 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 1B6491642A; Fri, 18 Jul 2003 10:03:44 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 76D2C163D1; Fri, 18 Jul 2003 10:03:43 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Terence Kearns , pgsql-sql@postgresql.org Subject: Re: (trigger function) -> ERROR: NEW used in non-rule query Date: Fri, 18 Jul 2003 10:03:42 +0100 User-Agent: KMail/1.4.3 References: <3F17AE38.5020302@cts.canberra.edu.au> In-Reply-To: <3F17AE38.5020302@cts.canberra.edu.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307181003.42279.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/250 X-Sequence-Number: 14364 On Friday 18 Jul 2003 9:22 am, Terence Kearns wrote: > I'm writing a trigger which wants to reference the pre-defined NEW record. > > I can do this > idval :=3D NEW.blah; > > This works fine!!! > > What I really need to do is > idval :=3D NEW.(quote_ident(TG_ARGV[3])); > or this > idval :=3D NEW.(TG_ARGV[3]); I'll give you the short answer - no you can't do this (in plpgsql). Which= =20 isn't to say it'll never be possible, but not at the moment. Can you afford to look at an alternative language? I'd suggest looking at T= CL,=20 although I must admit I've never used it myself. --=20 Richard Huxton