Re: interesting difference for queries...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: interesting difference for queries...
Дата
Msg-id 15259.1039022535@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: interesting difference for queries...  (Rod Taylor <rbt@rbt.ca>)
Ответы Re: interesting difference for queries...  (Rod Taylor <rbt@rbt.ca>)
Список pgsql-hackers
Rod Taylor <rbt@rbt.ca> writes:
>> cms=# CREATE TABLE foo(bar int);
>> CREATE
>> cms=# SELECT * from foo where bar=1.7;

> This is a numeric to integer coercion, which rounds

No, it's an integer to numeric promotion (the var is promoted, not the
constant).  Obviously the '=' can never return true in this case.

>> cms=# SELECT * from foo where bar='1.7';
>> ERROR:  pg_atoi: error in "1.7": can't parse ".7"

> This is a text to integer coercion, which doesn't round.

And should not, IMHO.  This is effectively the same as
... where bar = '1.7'::int

which it seems to me is quite correct to throw a bad-input error.
        regards, tom lane


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

Предыдущее
От: Robert Treat
Дата:
Сообщение: setQuerySnapshot in plpgsql functions in 7.3
Следующее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: [GENERAL] PostgreSQL Global Development Group Announces