| From: | Amit Langote <amitlan(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix error reporting for SQL/JSON path type mismatches |
| Date: | 2025-11-27 03:12:26 |
| Message-ID: | E1vOSQj-001avh-1r@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix error reporting for SQL/JSON path type mismatches
transformJsonFuncExpr() used exprType()/exprLocation() on the
possibly coerced path expression, which could be NULL when
coercion to jsonpath failed, leading to "cache lookup failed
for type 0" errors.
Preserve the original expression node so that type and location
in the "must be of type jsonpath" error are reported correctly.
Add regression tests to cover these cases.
Reported-by: Jian He <jian(dot)universality(at)gmail(dot)com>
Author: Jian He <jian(dot)universality(at)gmail(dot)com>
Reviewed-by: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Discussion: https://postgr.es/m/CACJufxHunVg81JMuNo8Yvv_hJD0DicgaVN2Wteu8aJbVJPBjZA@mail.gmail.com
Backpatch-through: 17
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/519fa0433b37701b357753a568080bee2c47d238
Modified Files
--------------
src/backend/parser/parse_expr.c | 23 +++++++++++++++--------
src/test/regress/expected/sqljson_queryfuncs.out | 8 ++++++++
src/test/regress/sql/sqljson_queryfuncs.sql | 2 ++
3 files changed, 25 insertions(+), 8 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Erik Rijkers | 2025-11-27 05:48:56 | Re: pgsql: doc: Fix incorrect wording for --file in pg_dump |
| Previous Message | Amit Langote | 2025-11-27 03:12:22 | pgsql: Fix error reporting for SQL/JSON path type mismatches |