| From: | Taiki Kondo <tai-kondo(at)yk(dot)jp(dot)nec(dot)com> |
|---|---|
| To: | "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Hiroshi Yanagisawa <hir-yanagisawa(at)ut(dot)jp(dot)nec(dot)com> |
| Subject: | Float value 'Infinity' is cast to numeric 1 on Windows |
| Date: | 2017-09-27 10:41:26 |
| Message-ID: | 12A9442FBAE80D4E8953883E0B84E088C8C7A2@BPXM01GP.gisp.nec.co.jp |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs pgsql-hackers |
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.
| Attachment | Content-Type | Size |
|---|---|---|
| fix_infinity_to_1.patch | application/octet-stream | 1.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kohei KaiGai | 2017-09-27 11:06:55 | Re: Float value 'Infinity' is cast to numeric 1 on Windows |
| Previous Message | Michael Paquier | 2017-09-27 05:18:04 | Re: Old row version in hot chain become visible after a freeze |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2017-09-27 10:48:14 | Re: Enhancements to passwordcheck |
| Previous Message | Stas Kelvich | 2017-09-27 10:12:43 | Re: Transactions involving multiple postgres foreign servers |