Re: Auto-update a field when record is changed - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Auto-update a field when record is changed
Date
Msg-id 20030822215217.L6822-100000@megazone.bigpanda.com
Whole thread Raw
In response to Auto-update a field when record is changed  (Stuart <sfbarbee@yahoo.com>)
Responses Re: Auto-update a field when record is changed
List pgsql-sql
On Fri, 22 Aug 2003, Stuart wrote:

> Folks,
>
>     I was wandering if there was a feasible way to automatically update a field
> in a table, say 'revision_date' in a record whenever any other field in the
> record is changed.  My attempts to use a trigger caused repeating loops and
> bombed with error.  I would like to be able to update such a field
> automatically anytime a record was updated.  Any help would be appreciated.

That seems like a job for a before trigger and changing the to be
update/inerted record before the action occurs in general.  Don't
use an update statement but change the record variables given as the NEW
row.



pgsql-sql by date:

Previous
From: Stuart
Date:
Subject: Auto-update a field when record is changed
Next
From: Rajesh Kumar Mallah
Date:
Subject: Re: Joined deletes but one table being a subquery.