Re: Auto-update a field when record is changed

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Stuart <sfbarbee(at)yahoo(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Auto-update a field when record is changed
Date: 2003-08-23 04:53:48
Message-ID: 20030822215217.L6822-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jamie Lawrence 2003-08-23 05:16:53 Re: Auto-update a field when record is changed
Previous Message Stuart 2003-08-23 03:32:47 Auto-update a field when record is changed