Re: Accessing field of OLD in trigger

From: Erik Jones <erik(at)myemma(dot)com>
To: Josh Trutwin <josh(at)trutwins(dot)homeip(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Accessing field of OLD in trigger
Date: 2007-10-12 16:17:51
Message-ID: 047ADD1A-E9E5-45B6-9200-C6EE230DE451@myemma.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Oct 12, 2007, at 8:18 AM, Josh Trutwin wrote:

> On Fri, 12 Oct 2007 12:00:55 +0200 (CEST)
> Daniel Drotos <drdani(at)mazsola(dot)iit(dot)uni-miskolc(dot)hu> 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
any of the other pl languages available if you can.

Erik Jones

Software Developer | Emma®
erik(at)myemma(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mike Adams 2007-10-13 17:44:52 Re: Refactored queries needing validation of syntactic equivalence
Previous Message Jonah H. Harris 2007-10-12 15:55:59 Re: OT: array_accum equivalent in Oracle