pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Williams <jeffw@globaldial.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Update timestamp on update
Date: Thu, 13 Oct 2005 10:42:06 +0800
Message-ID: <434DC97E.7000603@globaldial.com> (raw)
In-Reply-To: <16305.1129167889@sss.pgh.pa.us>
References: <434DB482.1000205@globaldial.com>
	<16305.1129167889@sss.pgh.pa.us>

Tom Lane wrote:

>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
>  
>
Thanks. Triggers was my first thought, but chapter 35 on Triggers didn't
really indicate a way I could do this easily and scared me with a lot of
c code. Maybe it is a good idea to present some of the more common
things you would want to do with triggers in the triggers chapter?

Jeff



view thread (9+ messages)  latest in thread

Message-ID: <434DC97E.7000603@globaldial.com>
Permalink:  ../434DC97E.7000603@globaldial.com/
Also on:    postgresql.org/message-id/434DC97E.7000603@globaldial.com

 · 

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: pgsql-sql@postgresql.org
  Cc: jeffw@globaldial.com, tgl@sss.pgh.pa.us
  Subject: Re: Update timestamp on update
  In-Reply-To: <434DC97E.7000603@globaldial.com>

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

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