Re: Re: Date of creation and of change

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Tille <tillea(at)rki(dot)de>
Cc: hlefebvre <hlefebvre(at)lexbase(dot)net>, PostgreSQL SQL <pgsql-sql(at)hub(dot)org>
Subject: Re: Re: Date of creation and of change
Date: 2000-08-25 14:14:48
Message-ID: 2205.967212888@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Andreas Tille <tillea(at)rki(dot)de> writes:
>> NEW.ChangedAt := timestamp(''now'');

> This avoids the error message, but doesn't have any effect to the value
> of ChangedAt. It just remains the same as CreatedAt :-(.

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.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message hlefebvre 2000-08-25 14:18:32 Re: Re: Date of creation and of change
Previous Message Andreas Tille 2000-08-25 13:02:28 Re: Date of creation and of change