Selective Auto-Timestamp [using triggers?]

From: Dan Lyke <danlyke(at)flutterby(dot)com>
To: Rajit Singh <singh(dot)raj(at)studychoice(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Selective Auto-Timestamp [using triggers?]
Date: 2001-01-11 16:32:17
Message-ID: 14941.57361.537181.77366@wynand.flutterby.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rajit Singh writes:
> The thing is, I also want to be able to update the timestamp field
> if I want to...

Here's my solution:

CREATE FUNCTION updated_stamp () RETURNS OPAQUE AS
' BEGIN
IF NEW.updated ISNULL THEN
NEW.updated := ''now'';
END IF;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-01-11 16:38:48 Re: "Cluster" means "tangle" for me
Previous Message Jeff Eckermann 2001-01-11 16:20:37 RE: "Cluster" means "tangle" for me