summaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/guc.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-03-11 17:53:09 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2019-03-11 17:53:09 -0400
commitd9c5e9629bf511a51328fd083ee452de88d91d9d (patch)
tree36d511b5e903f6e5410b8d06b5c4cfdddabc188b /src/backend/utils/misc/guc.c
parent8cacea7a725103f1a037a5ee06112ebe31051c66 (diff)
Give up on testing guc.c's behavior for "infinity" inputs.
Further buildfarm testing shows that on the machines that are failing ac75959cd's test case, what we're actually getting from strtod("-infinity") is a syntax error (endptr == value) not ERANGE at all. This test case is not worth carrying two sets of expected output for, so just remove it, and revert commit b212245f9's misguided attempt to work around the platform dependency. Discussion: https://postgr.es/m/E1h33xk-0001Og-Gs@gemulon.postgresql.org
Diffstat (limited to 'src/backend/utils/misc/guc.c')
-rw-r--r--src/backend/utils/misc/guc.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 1c4f9ac04e6..fe6c6f8a05a 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -6240,15 +6240,13 @@ parse_real(const char *value, double *result, int flags, const char **hintmsg)
if (hintmsg)
*hintmsg = NULL;
+ errno = 0;
val = strtod(value, &endptr);
- if (endptr == value)
- return false; /* no HINT for syntax error */
- /*
- * 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
- * if necessary. We do need to reject NaN explicitly, however.
- */
+ if (endptr == value || errno == ERANGE)
+ return false; /* no HINT for these cases */
+
+ /* reject NaN (infinities will fail range checks later) */
if (isnan(val))
return false; /* treat same as syntax error; no HINT */