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