Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0672C9FBEAD for ; Fri, 12 Oct 2007 13:18:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 08344-04 for ; Fri, 12 Oct 2007 13:18:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smtp116.iad.emailsrvr.com (smtp116.iad.emailsrvr.com [207.97.245.116]) by postgresql.org (Postfix) with ESMTP id 55DDA9FBE62 for ; Fri, 12 Oct 2007 13:18:03 -0300 (ADT) Received: from relay1.r1.iad.emailsrvr.com (localhost [127.0.0.1]) by relay1.r1.iad.emailsrvr.com (SMTP Server) with ESMTP id 39C9544C264; Fri, 12 Oct 2007 12:18:02 -0400 (EDT) Received: by relay1.r1.iad.emailsrvr.com (Authenticated sender: erik-AT-myemma.com) with ESMTP id 142AB44C1B6; Fri, 12 Oct 2007 12:18:02 -0400 (EDT) In-Reply-To: <20071012081812.358a9543@prokofiev.trutwins.homeip.net> References: <20071012081812.358a9543@prokofiev.trutwins.homeip.net> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <047ADD1A-E9E5-45B6-9200-C6EE230DE451@myemma.com> Cc: pgsql-sql@postgresql.org Content-Transfer-Encoding: quoted-printable From: Erik Jones Subject: Re: Accessing field of OLD in trigger Date: Fri, 12 Oct 2007 11:17:51 -0500 To: Josh Trutwin X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/65 X-Sequence-Number: 29437 On Oct 12, 2007, at 8:18 AM, Josh Trutwin wrote: > On Fri, 12 Oct 2007 12:00:55 +0200 (CEST) > Daniel Drotos wrote: > >> Hi, >> >> >> I'm working on a row level plpgsql trigger running after delete, >> using a 8.0.3 server. It gets a parameter which is a field name of >> the OLD record. How can that field be accessed? >> >> I'd like to do something like: >> >> for recvar in 'select OLD.'||quote_ident(TG_ARGV[0])... > > I THINK you are out of luck here. I hear it's possible to do but in > one of the other PL languages say pl/tcl, though I can't seem to find > an example.... Right, "dynamic variables" aren't available in plpgsql. Check out =20 any of the other pl languages available if you can. Erik Jones Software Developer | Emma=AE erik@myemma.com 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate & market in style. Visit us online at http://www.myemma.com