Re: inconsistent automatic casting between psql and function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: inconsistent automatic casting between psql and function
Дата
Msg-id 18900.1228847821@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: inconsistent automatic casting between psql and function  (Richard Huxton <dev@archonet.com>)
Ответы unique constraint on views  ("Jyoti Seth" <jyotiseth2001@gmail.com>)
Re: inconsistent automatic casting between psql and function  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-sql
Richard Huxton <dev@archonet.com> writes:
> That's because a quoted literal isn't necessarily a timestamp. Without
> context it could be anything, and in the context of comparing to a date
> the planner probably tries to make it a date.

I think the real point here is this:

regression=# select '2008-12-09 02:00:00'::date;   date    
------------2008-12-09
(1 row)

ie, when it does decide that a literal should be a date, it will happily
throw away any additional time-of-day fields that might be in there.
Had it raised an error, Stefano might have figured out his mistake
sooner.

ISTM we deliberately chose this behavior awhile back, but I wonder
whether it does more harm than good.
        regards, tom lane


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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: inconsistent automatic casting between psql and function
Следующее
От: "Jyoti Seth"
Дата:
Сообщение: unique constraint on views