Windows env returns error while running "select pgstatindex"
Rushabh Lathia <rushabh.lathia@gmail.com>
From: Rushabh Lathia <rushabh.lathia@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2011-08-24T09:09:22Z
Lists: pgsql-hackers
Attachments
- win_pgstat_fix.patch (application/octet-stream)
Description:
===========
Error Message " invalid input syntax for type double precision: -1#I" is
displayed while running "select pgstatindex"
Issue only getting reproduce on windows environment.
Analysis:
=========
Consider the following testcase to reproduce the issue on windows:
create table test (a int primary key );
Windows Output:
==============
psql>select pgstatindex('public.test_pkey');
ERROR: invalid input syntax for type double precision: "-1.#J"
Linux output:
==========
psql=# select pgstatindex('public.test_pkey');
pgstatindex
---------------------------
(2,0,0,0,0,0,0,0,NaN,NaN)
(1 row)
here when we run the select on linux its returning proper result and on
windows error coming from float8in() while trying to work for the NaN
values.
After debugging I noticed that "0/0" returning NaN on linux but it returns
"-1.#JIND0000" on windows. Now when float8in() getting call for such value
on windows it ending up with error "invalid input syntax for type double
precision:" as strtod() not able to understand such values.
I added to check into pgstatindex() to avoid "0/0" situation and issue got
fixed.
PFA patch for the same.
Thanks,
Rushabh Lathia
EnterpriseDB Corporation
The Enterprise Postgres Company
Website: http://www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb