[BUGS] Float value 'Infinity' is cast to numeric 1 on Windows - Mailing list pgsql-bugs

From Taiki Kondo
Subject [BUGS] Float value 'Infinity' is cast to numeric 1 on Windows
Date
Msg-id 12A9442FBAE80D4E8953883E0B84E088C8C7A2@BPXM01GP.gisp.nec.co.jp
Whole thread Raw
Responses Re: [BUGS] [HACKERS] Float value 'Infinity' is cast to numeric 1 on Windows
List pgsql-bugs
Hi all,

I build PostgreSQL 9.6.5 by Visual Studio 2013 on Windows, I found weird behavior on it.

I execute following SQL, occurring ERROR is expected, but I got mysterious value 1.


postgres=# select (float8 'inf')::numeric;
 numeric
---------
       1
(1 row)


On Windows, at least Visual Studio, the string of float/double value meaning
infinity is "1.#INF" not "inf". So, set_var_from_str() called from float8_numeric()
in utils/adt/numeric.c will return numeric value 1, and no one checks this situation.

This situation is also occurring by cast from float4.

I wrote a patch to add check this situation.
Please find attached.


Sincerely,

--
Taiki Kondo
NEC Solution Innovators, Ltd.



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachment

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [BUGS] Old row version in hot chain become visible after a freeze
Next
From: Kohei KaiGai
Date:
Subject: Re: [BUGS] [HACKERS] Float value 'Infinity' is cast to numeric 1 on Windows