diff options
Diffstat (limited to 'src/backend/utils/adt/formatting.c')
-rw-r--r-- | src/backend/utils/adt/formatting.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 16768b28c30..66264381366 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -6129,9 +6129,12 @@ numeric_to_char(PG_FUNCTION_ARGS) /* * numeric_out_sci() does not emit a sign for positive numbers. We * need to add a space in this case so that positive and negative - * numbers are aligned. We also have to do the right thing for NaN. + * numbers are aligned. Also must check for NaN/infinity cases, which + * we handle the same way as in float8_to_char. */ - if (strcmp(orgnum, "NaN") == 0) + if (strcmp(orgnum, "NaN") == 0 || + strcmp(orgnum, "Infinity") == 0 || + strcmp(orgnum, "-Infinity") == 0) { /* * Allow 6 characters for the leading sign, the decimal point, @@ -6346,7 +6349,7 @@ int8_to_char(PG_FUNCTION_ARGS) /* * numeric_out_sci() does not emit a sign for positive numbers. We * need to add a space in this case so that positive and negative - * numbers are aligned. We don't have to worry about NaN here. + * numbers are aligned. We don't have to worry about NaN/inf here. */ if (*orgnum != '-') { |