Re: Re: Date of creation and of change
От | hlefebvre |
---|---|
Тема | Re: Re: Date of creation and of change |
Дата | |
Msg-id | 39A65D1D.EB626E7D@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: > > On Wed, 23 Aug 2000, hlefebvre wrote: > > > Yes. The keywords NEW / OLD are available only in triggers > > see > > http://www.postgresql.org/users-lounge/docs/7.0/user/c40874113.htm#AEN4286 > Well, I believe that, but > > CREATE FUNCTION changed_at_timestamp() RETURNS OPAQUE AS ' > BEGIN > ChangedAt := timestamp(''now''); > RETURN NEW; > END; > ' LANGUAGE 'plpgsql'; <snip> > web=# insert into menu (IdMenu, ...) values (3, ... ); > ERROR: parser: parse error at or near "changedat" > > What's the problem here. No I suppose that the problem is the identifier "changedat" is unknown. You must probably prefix it : NEW.changedat CREATE FUNCTION changed_at_timestamp() RETURNS OPAQUE AS ' BEGIN NEW.ChangedAt := timestamp(''now''); RETURNNEW; END;' LANGUAGE 'plpgsql'; I didn't test it, but as pgSQL looks like Oracle, it should be ok :-) regards
В списке pgsql-sql по дате отправления: