From: | DM <dm(dot)aeqa(at)gmail(dot)com> |
---|---|
To: | Sairam Krishnamurthy <kmsram420(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Query precision issue |
Date: | 2010-10-25 17:28:54 |
Message-ID: | AANLkTi=Uu-R0-o8-jSAA9hYCXH3VGAyJe722zCEs1Q-g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello Sairam,
What is the type of the colum?, what version of postgres are you using?
I didn't had any problem retrieving data in both ways... check out the below
=============================================
test=# create temp table test (col1 float);
CREATE TABLE
test=# insert into test values(-107.689878);
INSERT 0 1
test=# select * from test where col1=-107.6898780000;
col1
-------------
-107.689878
(1 row)
test=# select * from test where col1=-107.689878000;
col1
-------------
-107.689878
(1 row)
test=# select * from version();
version
------------------------------------------------------------------------------------------------------------------
PostgreSQL 8.4.1 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC)
4.1.2 20071124 (Red Hat 4.1.2-42), 64-bit
(1 row)
============================================
Thanks
Deepak
On Mon, Oct 25, 2010 at 10:11 AM, Sairam Krishnamurthy
<kmsram420(at)gmail(dot)com>wrote:
> All,
>
> I have simple query like 'select * from table1 where
> column1=-107.6898780000'. This returns an empty set. But there is data
> corresponding to this value of column.
>
> When I looked more into it, it seems like a precision issue. The value for
> column1 is -107.689878.
>
> More interesting is that the following query fetches the row,
>
> 'select * from table1 where column1=-107.689878000'
>
> Note that there are only three trailing zeros in the second query while
> there were four in the first.
>
> Can somebody help me to find out the problem? I can very well truncate the
> trailing zeros when querying, but I am interested in finding why an
> additional trailing zero returns an empty set.
>
> --
> Thanks,
> Sairam Krishnamurthy
> +1 612 859 8161
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Fredric Fredricson | 2010-10-25 17:58:32 | Re: What is "return code" for WAL send command |
Previous Message | Sairam Krishnamurthy | 2010-10-25 17:11:11 | Query precision issue |