Re: Date of creation and of change
| От | Andreas Tille |
|---|---|
| Тема | Re: Date of creation and of change |
| Дата | |
| Msg-id | Pine.LNX.4.21.0008231541210.22247-100000@wr-linux02.rki.de обсуждение исходный текст |
| Ответ на | Re: Date of creation and of change (hlefebvre <hlefebvre@lexbase.net>) |
| Список | pgsql-sql |
On Wed, 23 Aug 2000, hlefebvre wrote:
> create table mytable( CreateDate timestamp default timestamp('now'),
> ....);
Thanks, this works.
> CREATE FUNCTION myt_stamp () RETURNS OPAQUE AS
> BEGIN
> ChangeDate := timestamp(''now'');
> RETURN NEW;
> END;
> ' LANGUAGE 'plpgsql';
I tried:
web=# CREATE FUNCTION changed_at_timestamp () RETURNS OPAQUE AS '
web'# BEGIN
web'# ChangeDate := timestamp(''now'');
web'# RETURN NEW;
web'# END;
web'# ' LANGUAGE 'plpgsql';
CREATE
web=# select changed_at_timestamp () ;
ERROR: typeidTypeRelid: Invalid type - oid = 0
web=#
Is this just the wrong way to test the function?
As a beginner I try to validate each new step I do and so I wonder
if I insert the Trigger you mentioned
> CREATE TRIGGER myt_stamp BEFORE INSERT OR UPDATE ON mytable
> FOR EACH ROW EXECUTE PROCEDURE myt_stamp();
the function could cause errors.
Sorry, I'm not very familiar with this function stuff :-(.
Kind regards
Andreas.
В списке pgsql-sql по дате отправления: