From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix jsonpath existense checking of missing variables
Date: Thu, 12 Jan 2023 15:26:32 +0000
Message-ID: <E1pFzTM-003J1A-8p@gemulon.postgresql.org> (raw)
Fix jsonpath existense checking of missing variables
The current jsonpath code assumes that the referenced variable always exists.
It could only throw an error at the value valuation time. At the same time
existence checking assumes variable is present without valuation, and error
suppression doesn't work for missing variables.
This commit makes existense checking trigger an error for missing variables.
This makes the overall behavior consistent.
Backpatch to 12 where jsonpath was introduced.
Reported-by: David G. Johnston
Discussion: https://postgr.es/m/CAKFQuwbeytffJkVnEqDyLZ%3DrQsznoTh1OgDoOF3VmOMkxcTMjA%40mail.gmail.com
Author: Alexander Korotkov, David G. Johnston
Backpatch-through: 12
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/4dc3f94fae3de3f19b5c7dd507beac0216b0cde9
Modified Files
--------------
src/backend/utils/adt/jsonpath_exec.c | 8 +++++--
src/test/regress/expected/jsonb_jsonpath.out | 32 ++++++++++++++++++++++++++++
src/test/regress/sql/jsonb_jsonpath.sql | 8 +++++++
3 files changed, 46 insertions(+), 2 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: akorotkov@postgresql.org
Subject: Re: pgsql: Fix jsonpath existense checking of missing variables
In-Reply-To: <E1pFzTM-003J1A-8p@gemulon.postgresql.org>
References: <E1pFzTM-003J1A-8p@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox