Re: Triggers and Audit Trail

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Jeff Amiel <jamiel(at)istreamimaging(dot)com>
Cc: Marcus Couto <marcus(at)altapoint(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Triggers and Audit Trail
Date: 2005-12-29 18:01:37
Message-ID: 20051229180137.GA53292@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Qingqing Zhou 2005-12-29 18:35:38 Re: how to add a new column to system table
Previous Message Jeff Amiel 2005-12-29 17:46:48 Re: Triggers and Audit Trail