Re: Touch row ?

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Chris Boget <chris(at)wild(dot)net>
Cc: Dustin Sallings <dustin(at)spy(dot)net>, NTPT <ntpt(at)centrum(dot)cz>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Touch row ?
Date: 2004-01-23 16:04:07
Message-ID: 1074873847.14313.9.camel@coppola.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general

On Fri, 2004-01-23 at 16: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?

No, that would only set the timestamp on INSERT, but not on any UPDATE.
The OP wanted to timestamp all updates too.

Cheers,
Csaba.

>
> Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-announce by date

  From Date Subject
Next Message Chris Boget 2004-01-23 16:08:21 Re: Touch row ?
Previous Message Doug McNaught 2004-01-23 16:00:37 Re: Touch row ?

Browse pgsql-general by date

  From Date Subject
Next Message Chris Boget 2004-01-23 16:08:21 Re: Touch row ?
Previous Message Doug McNaught 2004-01-23 16:00:37 Re: Touch row ?