From f4ae676e3178124c2bc2b3a3530efe8f3cdbc442 Mon Sep 17 00:00:00 2001 From: Alexander Korotkov Date: Sat, 11 Jul 2020 03:21:00 +0300 Subject: 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 --- src/backend/utils/adt/jsonb_util.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/backend/utils/adt/jsonb_util.c') diff --git a/src/backend/utils/adt/jsonb_util.c b/src/backend/utils/adt/jsonb_util.c index 7969f6f5843..53a0bb48b92 100644 --- a/src/backend/utils/adt/jsonb_util.c +++ b/src/backend/utils/adt/jsonb_util.c @@ -1728,14 +1728,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); -- cgit v1.2.3