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.