Re: constraints evaluate 'now' immediately

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: constraints evaluate 'now' immediately
Дата
Msg-id 27347.971726763@sss.pgh.pa.us
обсуждение исходный текст
Ответ на constraints evaluate 'now' immediately  (pgsql-bugs@postgresql.org)
Список pgsql-bugs
pgsql-bugs@postgresql.org writes:
> I would like a constraint stating that a column may not have a date in the future:
> CHECK(my_date <= 'now')
> but I think it stores the time of constraint creation.

Yes, because 'now' is evaluated when the constant is parsed.  Try
    CHECK(my_date <= now())
instead.

            regards, tom lane

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

Предыдущее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: constraints evaluate 'now' immediately
Следующее
От: Eivind Kvedalen
Дата:
Сообщение: bug-report