Re: "OLD." || myColumnNameVar (How to generically access columns in a trigger's OLD or NEW records)

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Basil Bourque <basil(dot)list(at)me(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: "OLD." || myColumnNameVar (How to generically access columns in a trigger's OLD or NEW records)
Date: 2011-04-28 20:08:26
Message-ID: F5C3FAF1-912F-4A06-AFA2-E6C0AF6DC864@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Apr 28, 2011, at 3:46 PM, Basil Bourque wrote:

> It seems that I cannot get PL/pgSQL to interpret the text of "NEW." + column name as text.
>
> My goal is to loop each field in a trigger, comparing the "OLD." & "NEW." values of each field. If different I want to log both values in a history/audit-trail table.
>
> Is there some way to loop the fields of a trigger's Record? I've read other people's frustration at not being able to get an array of fields from the Record.

This might help you:

http://wiki.postgresql.org/wiki/PL/pgSQL_Dynamic_Triggers

John DeSoi, Ph.D.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yeb Havinga 2011-04-28 20:25:46 Re: SSDs with Postgresql?
Previous Message hubert depesz lubaczewski 2011-04-28 19:57:10 Re: "OLD." || myColumnNameVar (How to generically access columns in a trigger's OLD or NEW records)