pgsql: Throw error in jsonb_path_match() when result is not single bool

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Throw error in jsonb_path_match() when result is not single bool
Date: 2019-04-01 15:18:12
Message-ID: E1hAyhQ-0001Hf-Bt@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Throw error in jsonb_path_match() when result is not single boolean

jsonb_path_match() checks if jsonb document matches jsonpath query. Therefore,
jsonpath query should return single boolean. Currently, if result of jsonpath
is not a single boolean, NULL is returned independently whether silent mode
is on or off. But that appears to be wrong when silent mode is off. This
commit makes jsonb_path_match() throw an error in this case.

Author: Nikita Glukhov

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b4cc19ab01ffe6a72a915b21aa41536de80923f5

Modified Files
--------------
src/backend/utils/adt/jsonpath_exec.c | 26 +++++++++-----
src/test/regress/expected/jsonb_jsonpath.out | 51 ++++++++++++++++++++++++++++
src/test/regress/sql/jsonb_jsonpath.sql | 12 +++++++
3 files changed, 80 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2019-04-01 18:25:56 pgsql: Unified logging system for command-line programs
Previous Message Peter Eisentraut 2019-04-01 08:49:27 pgsql: Catch syntax error in generated column definition