On Wed, 2002-12-04 at 11:21, Mario Weilguni wrote:
> I noticed an interesting difference in query behaviour:
> 
> cms=# CREATE TABLE foo(bar int);
> CREATE
> cms=# SELECT * from foo where bar=1.7;

This is a numeric to integer coercion, which rounds

rbt=# select 1.7::int;
 int4 
------
    2
(1 row)

>  bar
> -----
> (0 rows)
> 
> 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.


I guess the question is whether or not a numeric -> integer conversion
should 'wedge' numbers into the int, or throw an error.

-- 
Rod Taylor <[EMAIL PROTECTED]>

PGP Key: http://www.rbt.ca/rbtpub.asc

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to