From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Portability of strtod (was Re: pgsql: Include GUC's unit, if it has one, in out-of-range error message)
Date: Sun, 10 Mar 2019 23:15:40 -0400
Message-ID: <30864.1552274140@sss.pgh.pa.us> (raw)
In-Reply-To: <20190311011114.GD1818@paquier.xyz>
References: <E1h33xk-0001Og-Gs@gemulon.postgresql.org>
<20190311011114.GD1818@paquier.xyz>
Michael Paquier <michael@paquier.xyz> writes:
> On Sun, Mar 10, 2019 at 07:18:20PM +0000, Tom Lane wrote:
>> Include GUC's unit, if it has one, in out-of-range error messages.
> It does not seem to have cooled down all animals yet, whelk is
> still complaining:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=whelk&dt=2019-03-11%2000%3A41%3A13
Yeah, also the HPUX animals (gaur isn't booted up at the moment, but
I bet it'd fail too).
I think what's going on here is what's mentioned in the comments in
float8in_internal:
* C99 requires that strtod() accept NaN, [+-]Infinity, and [+-]Inf,
* but not all platforms support all of these (and some accept them
* but set ERANGE anyway...)
Specifically, these symptoms would be explained if these platforms'
strtod() sets ERANGE for infinity.
I can think of three plausible responses. In decreasing order of
amount of work:
1. Decide that we'd better wrap strtod() with something that ensures
platform-independent behavior for all our uses of strtod (and strtof?)
rather than only float8in_internal.
2. Put in a hack in guc.c to make it ignore ERANGE as long as the result
satisfies isinf(). This would ensure GUC cases would go through the
value-out-of-range path rather than the syntax-error path. We've got
a bunch of other strtod() calls that are potentially subject to similar
platform dependencies though ...
3. Decide this isn't worth avoiding platform dependencies for, and just
take out the new regression test case. I'd only put in that test on
the spur of the moment anyway, so it's hard to argue that it's worth
much.
Thoughts?
regards, tom lane
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-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, michael@paquier.xyz, pgsql-hackers@lists.postgresql.org
Subject: Re: Portability of strtod (was Re: pgsql: Include GUC's unit, if it has one, in out-of-range error message)
In-Reply-To: <30864.1552274140@sss.pgh.pa.us>
References: <E1h33xk-0001Og-Gs@gemulon.postgresql.org> <20190311011114.GD1818@paquier.xyz> <30864.1552274140@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