Re: Touch row ?

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Chris Boget" <chris(at)wild(dot)net>, "Dustin Sallings" <dustin(at)spy(dot)net>, "NTPT" <ntpt(at)centrum(dot)cz>
Cc: "PostgreSQL-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Touch row ?
Date: 2004-01-23 16:09:16
Message-ID: 200401231609.16791.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general

On Friday 23 January 2004 15:52, Chris Boget wrote:
> > > is it possible to add column to database, that will automatically
> > > contain date+time (or likely Unix timestamp) when the row was
> > > touched/changed - ie by INSERT or UPDATE ?
> >
> > Yes, a very simple trigger can do this.
>
> Wouldn't just setting the default value of the field to be NOW() accomplish
> the same thing? Or can you not default the value of a timestamp field?

That will work for insert, but won't change when you update.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-announce by date

  From Date Subject
Next Message Holger Marzen 2004-01-23 19:44:57 Article in German iX magazine
Previous Message Chris Boget 2004-01-23 16:08:21 Re: Touch row ?

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2004-01-23 16:19:09 Re: psql: relocation error: psql: undefined symbol: PQgetssl
Previous Message Chris Boget 2004-01-23 16:08:21 Re: Touch row ?