]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix jsonpath existense checking of missing variables
authorAlexander Korotkov <akorotkov@postgresql.org>
Thu, 12 Jan 2023 15:16:34 +0000 (18:16 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Thu, 12 Jan 2023 15:19:19 +0000 (18:19 +0300)
commit9e24e4781750ca92a0a5ff0aaa8e2091785c3bed
treeb98e97613fe5551722c26f004854e22bb5b4e177
parentc0ee6943ca1ded4b1a09be5832ef6e6bc257fb13
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
src/backend/utils/adt/jsonpath_exec.c
src/test/regress/expected/jsonb_jsonpath.out
src/test/regress/sql/jsonb_jsonpath.sql