Re: best way to auto-update a field when row is updated - Mailing list pgsql-sql

From Larry Rosenman
Subject Re: best way to auto-update a field when row is updated
Date
Msg-id 200503101421.33958.ler@lerctr.org
Whole thread Raw
In response to best way to auto-update a field when row is updated  (Henry Ortega <juandelacruz@gmail.com>)
List pgsql-sql
On Thursday 10 March 2005 02:09 pm, Henry Ortega wrote:
> 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)
>
trigger on update/insert.


> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq

-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 214-351-4152                 E-Mail: ler@lerctr.org
US Mail: 3535 Gaspar Drive, Dallas, TX 75220-3611


pgsql-sql by date:

Previous
From: Henry Ortega
Date:
Subject: best way to auto-update a field when row is updated
Next
From: Scott Marlowe
Date:
Subject: Re: best way to auto-update a field when row is updated