Re: Should we document how column DEFAULT expressions work?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Should we document how column DEFAULT expressions work?
Дата
Msg-id 1390099.1719357084@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Should we document how column DEFAULT expressions work?  (James Coleman <jtc331@gmail.com>)
Ответы Re: Should we document how column DEFAULT expressions work?
Список pgsql-hackers
James Coleman <jtc331@gmail.com> writes:
> On Tue, Jun 25, 2024 at 4:59 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Uh ... what?  I recall something about that with respect to certain
>> features such as nextval(), but you're making it sound like there
>> is something generic going on with DEFAULT.

> Hmm, I guess I'd never considered anything besides cases like
> nextval() and now(), but I see now that now() must also be special
> cased (when quoted) since 'date_trunc(day, now())'::timestamp doesn't
> work but 'now()'::timestamp does.

Hmm, both of those behaviors are documented, but not in the same place
and possibly not anywhere near where you looked for info about
DEFAULT.  For instance, the Tip at the bottom of section 9.9.5

https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

explains about how 'now'::timestamp isn't what to use in DEFAULT.

            regards, tom lane



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

Предыдущее
От: Noah Misch
Дата:
Сообщение: Re: IPC::Run accepts bug reports
Следующее
От: Alena Rybakina
Дата:
Сообщение: Re: POC, WIP: OR-clause support for indexes