Fix jsonpath existense checking of missing variables
Alexander Korotkov <akorotkov@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/jsonpath_exec.c | modified | +6 −2 |
| src/test/regress/expected/jsonb_jsonpath.out | modified | +32 −0 |
| src/test/regress/sql/jsonb_jsonpath.sql | modified | +8 −0 |
Discussion
- Bug in jsonb_path_exists (maybe _match) one-element scalar/variable jsonpath handling 13 messages · 2022-11-24 → 2023-01-12