Re: on update of table set timestamp

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Lance Campbell" <lance(at)illinois(dot)edu>,<pgsql-admin(at)postgresql(dot)org>
Subject: Re: on update of table set timestamp
Date: 2010-06-22 14:55:16
Message-ID: 4C20888402000025000327DB@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Campbell, Lance" <lance(at)illinois(dot)edu> wrote:

> I want to add a timestamp column to some of my important table
> such that whenever an SQL "update" command is executed on the
> table the "updated_timestamp" timestamp column would be set with
> "now()".

I would write one function which I would bind as a BEFORE UPDATE
trigger to all the tables with the updated_timestamp column. You
don't need to write a separate function for each table.

-Kevin

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kevin Grittner 2010-06-22 15:00:48 Re: Postgresql 9.0b2 : pg_upgrade not passing username to pgdumpall ?
Previous Message Tom Lane 2010-06-22 14:48:03 Re: blocking automatic vacuum