Re: Update timestamp on update - Mailing list pgsql-sql

From Tom Lane
Subject Re: Update timestamp on update
Date
Msg-id 16305.1129167889@sss.pgh.pa.us
Whole thread Raw
In response to Update timestamp on update  (Jeff Williams <jeffw@globaldial.com>)
Responses Re: Update timestamp on update  (Jeff Williams <jeffw@globaldial.com>)
List pgsql-sql
Jeff Williams <jeffw@globaldial.com> writes:
>     last_status_change timestamp DEFAULT now()

> What I would like is that whenever the status is changed the
> last_status_change timestamp is updated to the current time.

For this you use an ON UPDATE trigger; rules are not a good way to solve
it.  See the documentation about triggers.  The first example on this
page does it along with a few other things:
http://developer.postgresql.org/docs/postgres/plpgsql-trigger.html
        regards, tom lane


pgsql-sql by date:

Previous
From: Greg Stark
Date:
Subject: Re: pg, mysql comparison with "group by" clause
Next
From: Frank Bax
Date:
Subject: Re: SEVEN cross joins?!?!?