diff options
Diffstat (limited to 'src/backend/utils/adt/float.c')
-rw-r--r-- | src/backend/utils/adt/float.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index 7540ca22efe..77a5d7d42f8 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -337,7 +337,7 @@ float8in(PG_FUNCTION_ARGS) } /* Convenience macro: set *have_error flag (if provided) or throw error */ -#define RETURN_ERROR(throw_error) \ +#define RETURN_ERROR(throw_error, have_error) \ do { \ if (have_error) { \ *have_error = true; \ @@ -376,6 +376,9 @@ float8in_internal_opt_error(char *num, char **endptr_p, double val; char *endptr; + if (have_error) + *have_error = false; + /* skip leading whitespace */ while (*num != '\0' && isspace((unsigned char) *num)) num++; @@ -388,7 +391,8 @@ float8in_internal_opt_error(char *num, char **endptr_p, RETURN_ERROR(ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s: \"%s\"", - type_name, orig_string)))); + type_name, orig_string))), + have_error); errno = 0; val = strtod(num, &endptr); @@ -463,9 +467,9 @@ float8in_internal_opt_error(char *num, char **endptr_p, errnumber[endptr - num] = '\0'; RETURN_ERROR(ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("\"%s\" is out of range for " - "type double precision", - errnumber)))); + errmsg("\"%s\" is out of range for type double precision", + errnumber))), + have_error); } } else @@ -473,7 +477,8 @@ float8in_internal_opt_error(char *num, char **endptr_p, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type " "%s: \"%s\"", - type_name, orig_string)))); + type_name, orig_string))), + have_error); } #ifdef HAVE_BUGGY_SOLARIS_STRTOD else @@ -500,7 +505,8 @@ float8in_internal_opt_error(char *num, char **endptr_p, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type " "%s: \"%s\"", - type_name, orig_string)))); + type_name, orig_string))), + have_error); return val; } |