Re: Create a function that updates the record with and timestamps

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Create a function that updates the record with and timestamps
Date: 2010-03-22 17:14:00
Message-ID: 20100322171400.GA14658@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In response to Chris Barnes :
> I would like to have postgres update the last_modified column with the
> current_date on an update of the record.
>
> I am not sure if there is a very simple way of doing this?
>
> Or, do I need to create a function and a trigger to call the row and update
> with new data and set the last_modified to current_date?

Yes, that's the way, a TRIGGER on UPDATE for each row. I think, the doc
contains an example.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bob Pawley 2010-03-22 17:39:07 Postgresql error from interface
Previous Message Szymon Guz 2010-03-22 17:06:40 Re: strange