From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: PostgreSQL Hackers <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)
Date: Mon, 11 Mar 2019 11:06:33 -0400
Message-ID: <22688.1552316793@sss.pgh.pa.us> (raw)
In-Reply-To: <CAA4eK1J7SDgKm8zG-Q=hPUvQ6=wBmh=G0tgXHc8FR5BzzMF3PQ@mail.gmail.com>
References: <E1h33xk-0001Og-Gs@gemulon.postgresql.org>
<20190311011114.GD1818@paquier.xyz>
<30864.1552274140@sss.pgh.pa.us>
<CAA4eK1J7SDgKm8zG-Q=hPUvQ6=wBmh=G0tgXHc8FR5BzzMF3PQ@mail.gmail.com>
Amit Kapila <amit.kapila16@gmail.com> writes:
> On Mon, Mar 11, 2019 at 8:45 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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.
> This sounds like a good approach, but won't it has the risk of change
> in behaviour?
Well, the point would be to produce consistent behavior across platforms
where it's not consistent now. So yeah, some platforms would necessarily
see a behavior change. But I think your point is that changing this
everywhere is solving a problem that hasn't been complained about,
and that's a valid concern.
>> 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 ...
> Yeah, this won't completely fix the symptom.
It would fix things in an area where we're changing the behavior anyway,
so maybe that's the right scope to work at. After thinking about this
a little, it seems like simply ignoring ERANGE from strtod might get the
behavior we want: per POSIX strtod's result should be infinity for overflow
or zero for underflow, and proceeding with either of those should give
better behavior than treating the case as a syntax error. Anyway
I think I'll try that and see what the buildfarm says.
>> 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.
> For the time being option-3 sounds like a reasonable approach to fix
> buildfarm failures and then later if we want to do some bigger surgery
> based on option-1 or some other option, we can anyways do it.
Yeah, if I can't fix it pretty easily then I'll just remove the test
case. But the behavior shown in the expected result is a bit nicer than
what we're actually getting from these buildfarm animals, so ideally
we'd fix it.
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, amit.kapila16@gmail.com, 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: <22688.1552316793@sss.pgh.pa.us>
References: <E1h33xk-0001Og-Gs@gemulon.postgresql.org> <20190311011114.GD1818@paquier.xyz> <30864.1552274140@sss.pgh.pa.us> <CAA4eK1J7SDgKm8zG-Q=hPUvQ6=wBmh=G0tgXHc8FR5BzzMF3PQ@mail.gmail.com> <22688.1552316793@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