Skip site navigation (1) Skip section navigation (2)

Mod_date update technique

From: "Gary Hoffman" <ghoffman(at)ucsd(dot)edu>
To: pgsql-php(at)postgresql(dot)org
Subject: Mod_date update technique
Date: 2004-08-26 05:16:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-php
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

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.

Simply asked: What is the easiest way to automatically update the mod_date
field when the record is updated?


* Gary B. Hoffman, Computing Services Manager  e-mail: ghoffman(at)ucsd(dot)edu *
* Graduate School of International Relations and Pacific Studies (IR/PS) *
* University of California, San Diego (UCSD)       voice: (858) 534-1989 *
* 9500 Gilman Dr.  MC 0519                           fax: (858) 534-3939 *
* La Jolla, CA 92093-0519 USA                 web: *


pgsql-php by date

Next:From: Justin WyerDate: 2004-08-26 06:52:03
Subject: Re: Mod_date update technique
Previous:From: Majolee InfoTech (Hotmail)Date: 2004-08-21 14:10:12
Subject: Dynamic Record Type Field Names

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group