Re: Mod_date update technique

From: Justin Wyer <justin(at)isogo(dot)co(dot)za>
To: Gary Hoffman <ghoffman(at)ucsd(dot)edu>, pgsql-php <pgsql-php(at)postgresql(dot)org>
Subject: Re: Mod_date update technique
Date: 2004-08-26 06:52:03
Message-ID: 412D8893.9070803@isogo.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Gary Hoffman wrote:

>I have a column named mod_date on a particular table. It has a default
>value of now() which is the create date of the row. However, I want to
>update that field with the current timestamp whenever its record is
>updated.
>
>I know how to do this using PHP by including the date() in the data I'm
>using to update the record. However, I would like to do this on the
>PostgreSQL side of the transaction. I can't figure out how to write a
>trigger or other technique to do this.
>
>
A trigger is the correct way.

>Simply asked: What is the easiest way to automatically update the mod_date
>field when the record is updated?
>
>
Check out the PostgreSQL documentation it is quite comprehensive.
http://www.postgresql.org/docs/7.4/interactive/triggers.html

Regards
Justin

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Gene Stevens 2004-08-26 16:28:48 Re: Mod_date update technique
Previous Message Gary Hoffman 2004-08-26 05:16:04 Mod_date update technique