pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix error reporting for SQL/JSON path type mismatches
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix error reporting for SQL/JSON path type mismatches
@ 2025-11-27 03:12 Amit Langote <amitlan@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Amit Langote @ 2025-11-27 03:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.universality@gmail.com>
Author: Jian He <jian.universality@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/CACJufxHunVg81JMuNo8Yvv_hJD0DicgaVN2Wteu8aJbVJPBjZA@mail.gmail.com
Backpatch-through: 17

Branch
------
REL_17_STABLE

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

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(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix error reporting for SQL/JSON path type mismatches
@ 2025-11-27 03:12 Amit Langote <amitlan@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Amit Langote @ 2025-11-27 03:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.universality@gmail.com>
Author: Jian He <jian.universality@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/CACJufxHunVg81JMuNo8Yvv_hJD0DicgaVN2Wteu8aJbVJPBjZA@mail.gmail.com
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/15ba0702c1ae9d46f49a6e1f80db99167d3aedf7

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(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix error reporting for SQL/JSON path type mismatches
@ 2025-11-27 03:12 Amit Langote <amitlan@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Amit Langote @ 2025-11-27 03:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.universality@gmail.com>
Author: Jian He <jian.universality@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.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(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-11-27 03:12 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-11-27 03:12 pgsql: Fix error reporting for SQL/JSON path type mismatches Amit Langote <amitlan@postgresql.org>
2025-11-27 03:12 pgsql: Fix error reporting for SQL/JSON path type mismatches Amit Langote <amitlan@postgresql.org>
2025-11-27 03:12 pgsql: Fix error reporting for SQL/JSON path type mismatches Amit Langote <amitlan@postgresql.org>

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