best way to auto-update a field when row is updated

From: Henry Ortega <juandelacruz(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: best way to auto-update a field when row is updated
Date: 2005-03-10 20:09:42
Message-ID: 2bffcc3305031012092fde7dc2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have the following table

FIELD_A | FIELD_B | TSTAMP
--------------------------------------------------------------------------------------------------------
x y 2005-03-10
14:56:47.456431

TSTAMP = not null default now()

What's the best way to always auto-update TSTAMP to it's
default value whenever the row gets updated?
(e.g. update TABLENAME set FIELD_A='zzz' where FIELD_A='x';
should automatically set TSTAMP to now)

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Larry Rosenman 2005-03-10 20:21:33 Re: best way to auto-update a field when row is updated
Previous Message AL ELK 2005-03-10 09:30:45 Re: interval +variable