Received: from mx2.imaginet.fr (artemis.imaginet.fr [195.68.75.24]) by hub.org (8.10.1/8.10.1) with ESMTP id e7PBZ4501478 for ; Fri, 25 Aug 2000 07:35:05 -0400 (EDT) Received: from lexbase.net (access-34.125.rev.fr.colt.net [195.68.125.34] (may be forged)) by mx2.imaginet.fr (8.9.3/8.8.8) with ESMTP id NAA08026; Fri, 25 Aug 2000 13:33:23 +0200 (MET DST) Message-ID: <39A65D1D.EB626E7D@lexbase.net> Date: Fri, 25 Aug 2000 13:48:45 +0200 From: hlefebvre Organization: LEXBASE X-Mailer: Mozilla 4.73 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Andreas Tille CC: PostgreSQL SQL Subject: Re: Re: Date of creation and of change References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200008/277 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'; > 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''); RETURN NEW; END; ' LANGUAGE 'plpgsql'; I didn't test it, but as pgSQL looks like Oracle, it should be ok :-) regards