aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonb_util.c
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2020-07-11 03:21:00 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2020-07-11 03:21:00 +0300
commitdf646509f371069c65f84309eb5749642e8650b3 (patch)
tree8fc801b1d4906aeef99e0952a43455da1671d262 /src/backend/utils/adt/jsonb_util.c
parent0657181167467ec5cfb5a28aacf47ca02f5f4588 (diff)
downloadpostgresql-df646509f371069c65f84309eb5749642e8650b3.tar.gz
postgresql-df646509f371069c65f84309eb5749642e8650b3.zip
Forbid numeric NaN in jsonpath
SQL standard doesn't define numeric Inf or NaN values. It appears even more ridiculous to support then in jsonpath assuming JSON doesn't support these values as well. This commit forbids returning NaN from .double(), which was previously allowed. NaN can't be result of inner-jsonpath computation over non-NaNs. So, we can not expect NaN in the jsonpath output. Reported-by: Tom Lane Discussion: https://postgr.es/m/203949.1591879542%40sss.pgh.pa.us Author: Alexander Korotkov Reviewed-by: Tom Lane Backpatch-through: 12
Diffstat (limited to 'src/backend/utils/adt/jsonb_util.c')
-rw-r--r--src/backend/utils/adt/jsonb_util.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/backend/utils/adt/jsonb_util.c b/src/backend/utils/adt/jsonb_util.c
index 04b70c805b4..4eeffa14243 100644
--- a/src/backend/utils/adt/jsonb_util.c
+++ b/src/backend/utils/adt/jsonb_util.c
@@ -1773,14 +1773,6 @@ convertJsonbScalar(StringInfo buffer, JEntry *jentry, JsonbValue *scalarVal)
break;
case jbvNumeric:
- /* replace numeric NaN with string "NaN" */
- if (numeric_is_nan(scalarVal->val.numeric))
- {
- appendToBuffer(buffer, "NaN", 3);
- *jentry = 3;
- break;
- }
-
numlen = VARSIZE_ANY(scalarVal->val.numeric);
padlen = padBufferToInt(buffer);