From: hlefebvre <hlefebvre@lexbase.net>
To: Andreas Tille <tillea@rki.de>
To: PostgreSQL SQL <pgsql-sql@hub.org>
Subject: Re: Date of creation and of change
Date: Wed, 23 Aug 2000 12:39:39 +0200
Message-ID: <39A3A9EB.E6AF09D5@lexbase.net> (raw)
References: <Pine.LNX.4.21.0008231207160.22247-100000@wr-linux02.rki.de>
Andreas Tille wrote:
>
> Hello,
>
> could someone enlighten a fairly beginner how to define columns
> of a table with the following features:
>
> CreateDate DEFAULT value should store current date and time
create table mytable( CreateDate timestamp default timestamp('now'),
....);
> ChangeDate DEFAULT value at creation as above and a Trigger
> function which stores data end time of any change
> to the data set
must be something like that :
CREATE FUNCTION myt_stamp () RETURNS OPAQUE AS
BEGIN
ChangeDate := timestamp(''now'');
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
CREATE TRIGGER myt_stamp BEFORE INSERT OR UPDATE ON mytable
FOR EACH ROW EXECUTE PROCEDURE myt_stamp();
> I hope someone has this quite usual feature handy or at least a
> pointer where this is described.
>
> Thank you very much
>
> Andreas.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: hlefebvre@lexbase.net, tillea@rki.de, pgsql-sql@hub.org
Subject: Re: Date of creation and of change
In-Reply-To: <39A3A9EB.E6AF09D5@lexbase.net>
References: <Pine.LNX.4.21.0008231207160.22247-100000@wr-linux02.rki.de> <39A3A9EB.E6AF09D5@lexbase.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox