Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...
Дата
Msg-id 21092.1045545421@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...  (Sean Chittenden <sean@chittenden.org>)
Список pgsql-general
Sean Chittenden <sean@chittenden.org> writes:
> iirc, you have to put quotes around CURRENT_TIMESTAMP otherwise the
> default value is set to the CURRENT_TIMESTAMP at this very instant
> instead of being evaluated at runtime when a record is inserted.  -sc

Not so --- CURRENT_TIMESTAMP is a function, not a literal, despite the
lack of parentheses (you can blame the SQL spec for that weirdness).
It will in fact *not* work when quoted.

I think you are thinking of now() --- now() is a function, 'now' is
an acceptable timestamp literal, but the latter is generally a bad
choice for a column default because of the time-of-evaluation issue.

            regards, tom lane

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

Предыдущее
От: Dennis Gearon
Дата:
Сообщение: Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Index not used with IS NULL