Re: Touch row ?

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: NTPT <ntpt(at)centrum(dot)cz>, PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Touch row ?
Date: 2004-01-23 09:42:29
Message-ID: 4010EC85.5030301@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general

Mike Mascari wrote:

> CREATE FUNCTION touch() RETURNS trigger AS '
> begin
> NEW.mod_date = LOCALTIMESTAMP;
> return NEW;
> end;
> ' language 'plpgsql';
>
> CREATE TRIGGER t_foo
> BEFORE INSERT OR UPDATE ON foo
> FOR EACH ROW
> EXECUTE PROCEDURE touch();
>
> If you want timezone information, use TIMESTAMP WITH TIME ZONE and
> CURRENTTIMESTAMP. These are transaction start times.

Should read: CURRENT_TIMESTAMP

Mike Mascari

In response to

Browse pgsql-announce by date

  From Date Subject
Next Message Chris Boget 2004-01-23 15:52:04 Re: Touch row ?
Previous Message Mike Mascari 2004-01-23 09:35:57 Re: Touch row ?

Browse pgsql-general by date

  From Date Subject
Next Message lnd 2004-01-23 09:45:40 Optimizing SQL: bind variables, prepared stms, histograms
Previous Message Mike Mascari 2004-01-23 09:35:57 Re: Touch row ?