public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Jeff Williams <[email protected]>
Cc: [email protected]
Subject: Re: Update timestamp on update
Date: Wed, 12 Oct 2005 21:44:49 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Jeff Williams <[email protected]> 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



view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Update timestamp on update
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox