Received: from mx2.imaginet.fr (artemis.imaginet.fr [195.68.75.24]) by hub.org (8.10.1/8.10.1) with ESMTP id e7PFCnI73760 for ; Fri, 25 Aug 2000 11:12:50 -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 RAA18404; Fri, 25 Aug 2000 17:07:07 +0200 (MET DST) Message-ID: <39A68F32.7C781690@lexbase.net> Date: Fri, 25 Aug 2000 17:22:26 +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: Tom Lane , 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/284 Andreas Tille wrote: > > On Fri, 25 Aug 2000, Tom Lane wrote: > > > I think you are getting burnt by premature constant folding --- see > > nearby discussion of how to define a column default that gives the > > time of insertion. You need to write this as > > NEW.ChangedAt := now(); > > to prevent the system from reducing timestamp('now') to a constant > > when the function is first executed. > This doesn't work, too. > It just puts allways the constant time when the function was created > into the database. May be it has to be escaped in somw way?? > > I don't know how to follow hlefebvre's hint to "put null" into the > field. As I said, I was wrong, and Tom is right. I was suspecting a problem if the field is not used in the query, but the pb was about the now() function. > Bay the way: If we once solved the problem it might be a topic for > the FAQ, perhaps? IMHO this is a documentation problem. There is no example about such trigger who will modify data, and 'now' is described as "transaction time". also, in date/time function now() is not mentionned (doc about pgSQL 7.0 on the web site at http://www.postgresql.org/users-lounge/docs/7.0/user/functions2872.htm)