Re: looping on NEW and OLD in a trigger

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Michael P(dot) Soulier" <michael_soulier(at)mitel(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: looping on NEW and OLD in a trigger
Date: 2010-08-26 16:29:23
Message-ID: 19546.1282840163@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Michael P. Soulier" <michael_soulier(at)mitel(dot)com> writes:
> I'm very new to writing postgres procedures, and I'm trying to loop over
> the fields in the NEW and OLD variables available in an after trigger,
> and I can't quite get the syntax correct.

If you're trying to do this in plpgsql, the answer is you can't.
plpgsql doesn't support dynamic field references, which is what you'd
need for what (I think) you're trying to do.

You can do it in pltcl or plperl, and probably also plpython though
I don't know enough python to be sure.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael P. Soulier 2010-08-26 16:59:16 Re: looping on NEW and OLD in a trigger
Previous Message bricklen 2010-08-26 16:09:54 Re: unexpected message type 0x58 during COPY from stdin