Re: Literal vs parameterized 'timestamp with time zone' value

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Literal vs parameterized 'timestamp with time zone' value
Дата
Msg-id 7656.1182273574@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Literal vs parameterized 'timestamp with time zone' value  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
Kris Jurka <books@ejurka.com> writes:
> In the second example a string comparison is being done instead of a
> timestamp comparison.  Consider this psql example:

> jurka=# select now() < 'a'::text;
>   ?column?
> ----------
>   t
> (1 row)

BTW, as of 8.3 this particular foot-gun will go away:

regression=# select now() < 'a'::text;
ERROR:  operator does not exist: timestamp with time zone < text
LINE 1: select now() < 'a'::text;
                     ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

You'll still be able to force a textual comparison if you really want
one:

regression=# select now()::text < 'a'::text;
 ?column?
----------
 t
(1 row)

but it won't happen silently.

            regards, tom lane

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: SSL support for javax.sql.DataSource
Следующее
От: "Albe Laurenz"
Дата:
Сообщение: Re: SSL support for javax.sql.DataSource