Re: Re: Date of creation and of change - Mailing list pgsql-sql

From hlefebvre
Subject Re: Re: Date of creation and of change
Date
Msg-id 39A68F32.7C781690@lexbase.net
Whole thread Raw
In response to Re: Date of creation and of change  (Andreas Tille <tillea@rki.de>)
List pgsql-sql

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)


pgsql-sql by date:

Previous
From: Andreas Tille
Date:
Subject: Re: Date of creation and of change
Next
From: Renato De Giovanni
Date:
Subject: Re: weird structure