From: Tom Lane <tgl@sss.pgh.pa.us>
To: grv87@yandex.ru
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value
Date: Fri, 02 Aug 2013 17:05:24 -0400
Message-ID: <8645.1375477524@sss.pgh.pa.us> (raw)
In-Reply-To: <7861.1375475031@sss.pgh.pa.us>
References: <E1V5C2C-0005EG-L3@wrigleys.postgresql.org>
<7861.1375475031@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
I wrote:
> ... further experimentation says that this doesn't work on my ancient
> HPUX box; and you're complaining about Windows. So what we've got here
> is a platform dependency in the behavior of strtod(). I don't think
> we can promise to hide all such dependencies, but maybe it'd be a good
> idea to take care of this particular one.
I took a look in the C99 standard, and what it has to say about it is
actually this:
[#3] The expected form of the subject sequence is an
optional plus or minus sign, then one of the following:
-- a nonempty sequence of decimal digits optionally
containing a decimal-point character, then an optional
exponent part as defined in 6.4.4.2;
-- a 0x or 0X, then a nonempty sequence of hexadecimal
digits optionally containing a decimal-point character,
then an optional binary-exponent part as defined in
6.4.4.2, where either the decimal-point character or
the binary-exponent part is present;
-- one of INF or INFINITY, ignoring case
-- one of NAN or NAN(n-char-sequence-opt), ignoring case
in the NAN part, where:
n-char-sequence:
digit
nondigit
n-char-sequence digit
n-char-sequence nondigit
Current versions of the POSIX standard say the same, though SUS v2
didn't mention any of the non-numeric variants.
So what we've got is that Windows and some other (obsolete?) platforms
don't accept everything the standard says they should, and that results in
a visible cross-platform behavioral difference for us.
I'm not at all excited about supporting 0x... constants, nor about the
expanded form of NaN. But it seems like maybe we had better cover the
following cases that we do not cover today:
inf
+inf
-inf
+Infinity
We already backstop strtod() for these cases:
NaN
Infinity
-Infinity
but the wording of the spec clearly requires +Infinity as well as the
forms with just "inf". (It also appears to require +/- NaN to be
accepted, but I have no idea what that would mean and suspect it to
be a thinko.)
Barring objections I'll go make this change.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, grv87@yandex.ru
Subject: Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value
In-Reply-To: <8645.1375477524@sss.pgh.pa.us>
References: <E1V5C2C-0005EG-L3@wrigleys.postgresql.org> <7861.1375475031@sss.pgh.pa.us> <8645.1375477524@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox