Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3BPu-0000JX-F6 for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Mar 2019 03:15:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3BPs-0004uW-QM for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Mar 2019 03:15:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3BPs-0004qU-HL for pgsql-hackers@lists.postgresql.org; Mon, 11 Mar 2019 03:15:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3BPk-0007YB-T8 for pgsql-hackers@lists.postgresql.org; Mon, 11 Mar 2019 03:15:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x2B3Febd030865; Sun, 10 Mar 2019 23:15:40 -0400 From: Tom Lane To: Michael Paquier 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) In-reply-to: <20190311011114.GD1818@paquier.xyz> References: <20190311011114.GD1818@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Mon, 11 Mar 2019 10:11:14 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30863.1552274140.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 10 Mar 2019 23:15:40 -0400 Message-ID: <30864.1552274140@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier 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=3Dwhelk&dt=3D201= 9-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 [+-]In= f, * but not all platforms support all of these (and some accept the= m * 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