Re: 'real' strange problem in 7.1.3 - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: 'real' strange problem in 7.1.3
Date
Msg-id 20011109121450.Q58847-100000@megazone23.bigpanda.com
Whole thread Raw
In response to 'real' strange problem in 7.1.3  (reina@nsi.edu (Tony Reina))
List pgsql-hackers
>
> Now I try the same command with a different 'real' field:
> db02=# select distinct arm from ellipse where ellipse_ratio = 1.8;
>  arm
> -----
> (0 rows)
>
> BUT, if I put the value in quotes (as if it were a string), I get:
>
> db02=# select distinct arm from ellipse where ellipse_ratio = '1.8';
>  arm
> -----
>  L
>  R
> (2 rows)
>
> which is correct.

The reason is that in the first, the 1.8 is treated as double precision
which is slightly different than the 1.8 as real (you can see this with
a select 1.8::real-1.8;). I think the second postpones deciding the type
and gets converted into a 1.8 as real.




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 'real' strange problem in 7.1.3
Next
From: Doug McNaught
Date:
Subject: Re: Possible major bug in PlPython (plus some other ideas)