Commit b212245f authored by Tom Lane's avatar Tom Lane

In guc.c, ignore ERANGE errors from strtod().

Instead, just proceed with the infinity or zero result that it should
return for overflow/underflow.  This avoids a platform dependency,
in that various versions of strtod are inconsistent about whether they
signal ERANGE for a value that's specified as infinity.

It's possible this won't be enough to remove the buildfarm failures
we're seeing from ac75959c, in which case I'll take out the infinity
test case that commit added.  But first let's see if we can fix it.

Discussion: https://postgr.es/m/E1h33xk-0001Og-Gs@gemulon.postgresql.org
parent 08cecfaf
...@@ -6240,13 +6240,15 @@ parse_real(const char *value, double *result, int flags, const char **hintmsg) ...@@ -6240,13 +6240,15 @@ parse_real(const char *value, double *result, int flags, const char **hintmsg)
if (hintmsg) if (hintmsg)
*hintmsg = NULL; *hintmsg = NULL;
errno = 0;
val = strtod(value, &endptr); val = strtod(value, &endptr);
if (endptr == value)
return false; /* no HINT for syntax error */
if (endptr == value || errno == ERANGE) /*
return false; /* no HINT for these cases */ * We ignore strtod's errno, so that out-of-range inputs will just result
* in zero or infinity values. Subsequent range checks will reject those
/* reject NaN (infinities will fail range checks later) */ * if necessary. We do need to reject NaN explicitly, however.
*/
if (isnan(val)) if (isnan(val))
return false; /* treat same as syntax error; no HINT */ return false; /* treat same as syntax error; no HINT */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment