Re: Triggers and Audit Trail - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Triggers and Audit Trail
Date
Msg-id 20051229180137.GA53292@winnie.fuhr.org
Whole thread Raw
In response to Re: Triggers and Audit Trail  (Jeff Amiel <jamiel@istreamimaging.com>)
List pgsql-general
On Thu, Dec 29, 2005 at 11:44:26AM -0600, Jeff Amiel wrote:
> >Using triggers, is there a way to loop through the fields of the OLD
> >and NEW records? I haven't found a generic way to get the field name
> >and value that triggered the update other than hard coding if
> >statements to compare every field of the OLD and NEW records.
>
> We (my company) never found a way.  We ended up writing java code that
> analyzed the catalog tables that generated the appropriate 'if'
> statements in the trigger functions  for us....

As far as I know you can't do this yet in PL/pgSQL, but you can in
other languages like PL/Perl and PL/Tcl.

--
Michael Fuhr

pgsql-general by date:

Previous
From: Jeff Amiel
Date:
Subject: Re: Triggers and Audit Trail
Next
From: "Qingqing Zhou"
Date:
Subject: Re: how to add a new column to system table