Re: Date of creation and of change
| От | hlefebvre |
|---|---|
| Тема | Re: Date of creation and of change |
| Дата | |
| Msg-id | 39A3A9EB.E6AF09D5@lexbase.net обсуждение исходный текст |
| Ответ на | Date of creation and of change (Andreas Tille <tillea@rki.de>) |
| Ответы |
Re: Date of creation and of change
Re: Date of creation and of change |
| Список | pgsql-sql |
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.
В списке pgsql-sql по дате отправления: