Re: Updating column on row update

From: "Aaron Burnett" <aburnett(at)bzzagent(dot)com>
To: "Thom Brown" <thombrown(at)gmail(dot)com>, "PGSQL Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Updating column on row update
Date: 2009-11-22 19:57:48
Message-ID: 93E21628499A994AB281540F9B9A11DA908C1D@EXCHENT01.bzzagent.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


this is how I do it if this helps:

column_name timestamp without time zone NOT NULL DEFAULT ('now'::text)::timestamp(6) without time zone

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org on behalf of Thom Brown
Sent: Sun 11/22/2009 2:50 PM
To: PGSQL Mailing List
Subject: [GENERAL] Updating column on row update

Hi,

This should be simple, but for some reason I'm not quite sure what the
solution is. I want to be able to update the value of a column for rows
that have been updated. More specifically, if a row is updated, I want it's
modified_date column to be populated with the current time stamp. I've
looked at triggers and rules, and it looks like I'd need to create a
function just to achieve this which seems incredibly clumsy and unnecessary.
Could someone enlighten me?

Thanks

Thom

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2009-11-22 20:09:04 Re: Updating column on row update
Previous Message Thom Brown 2009-11-22 19:50:53 Updating column on row update

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2009-11-22 20:02:08 Re: Partitioning option for COPY
Previous Message Andrew Dunstan 2009-11-22 19:57:16 WIP: log query in auto-explain