Forbid numeric NaN in jsonpath
authorAlexander Korotkov <akorotkov@postgresql.org>
Sat, 11 Jul 2020 00:21:00 +0000 (03:21 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Sat, 11 Jul 2020 00:21:00 +0000 (03:21 +0300)
commitdf646509f371069c65f84309eb5749642e8650b3
tree8fc801b1d4906aeef99e0952a43455da1671d262
parent0657181167467ec5cfb5a28aacf47ca02f5f4588
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
src/backend/utils/adt/jsonpath_exec.c
src/test/regress/expected/jsonb_jsonpath.out