Re: Re: Date of creation and of change

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: Date of creation and of change
Дата
Msg-id 2205.967212888@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Date of creation and of change  (Andreas Tille <tillea@rki.de>)
Ответы Re: Date of creation and of change
Список pgsql-sql
Andreas Tille <tillea@rki.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 asNEW.ChangedAt := now();
to prevent the system from reducing timestamp('now') to a constant
when the function is first executed.
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: hlefebvre
Дата:
Сообщение: Re: Re: Date of creation and of change
Следующее
От: Andreas Tille
Дата:
Сообщение: Re: Date of creation and of change