pgsql: Forbid numeric NaN in jsonpath

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Forbid numeric NaN in jsonpath
Date: 2020-07-11 00:25:36
Message-ID: E1ju3Ki-00014Z-1E@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/89a0b1a7ca0af36818ed7076c12ac00bcf4f007d

Modified Files
--------------
src/backend/utils/adt/jsonb_util.c | 8 --------
src/backend/utils/adt/jsonpath_exec.c | 15 ++++++++-------
src/test/regress/expected/jsonb_jsonpath.out | 12 ++----------
3 files changed, 10 insertions(+), 25 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2020-07-11 00:25:40 pgsql: Forbid numeric NaN in jsonpath
Previous Message Alexander Korotkov 2020-07-11 00:25:30 pgsql: Improve error reporting for jsonpath .double() method