Re: Re: Date of creation and of change
От | hlefebvre |
---|---|
Тема | Re: Re: Date of creation and of change |
Дата | |
Msg-id | 39A3E145.55A6F495@lexbase.net обсуждение исходный текст |
Ответ на | Re: Date of creation and of change (Andreas Tille <tillea@rki.de>) |
Ответы |
Re: Date of creation and of change
|
Список | pgsql-sql |
Andreas Tille wrote: > 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? Yes. The keywords NEW / OLD are available only in triggers see http://www.postgresql.org/users-lounge/docs/7.0/user/c40874113.htm#AEN4286 > 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 по дате отправления: