| From: | Richard Guo <rguo(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Don't let JSON constructor coercions block SQL function inlining |
| Date: | 2026-09-14 08:09:57 |
| Message-ID: | E1x61lF-00000000G0j-1jZq@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Don't let JSON constructor coercions block SQL function inlining
contain_context_dependent_node_walker() reports a CaseTestExpr as
context-dependent unless it sits under a simple CaseExpr or the
elemexpr of an ArrayCoerceExpr. A JsonConstructorExpr whose RETURNING
type requires a coercion also carries a CaseTestExpr placeholder in
that coercion, so any SQL function called with such a constructor as
an argument was refused inlining.
Teach the walker that a CaseTestExpr is expected within the coercion
of a JsonConstructorExpr, the same way it already handles the elemexpr
of an ArrayCoerceExpr. This is safe now that eval_const_expressions
no longer lets an enclosing simple CASE clobber that placeholder.
Author: Richard Guo <guofenglinux(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAMbWs48A=VCFbteTkuCoknO1_0-Cu0aMBT0M07dm7vj1QyixDg@mail.gmail.com
Backpatch-through: 19
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/9d0adee8768852fc0e5713ec27cf52d46d97279d
Modified Files
--------------
src/backend/optimizer/util/clauses.c | 23 ++++++++++++++++++++++-
src/test/regress/expected/sqljson.out | 18 ++++++++++++++++++
src/test/regress/sql/sqljson.sql | 8 ++++++++
3 files changed, 48 insertions(+), 1 deletion(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Etsuro Fujita | 2026-09-14 10:04:07 | pgsql: postgres_fdw: Disable attribute statistics import from pre-9.1 s |
| Previous Message | Michael Paquier | 2026-09-14 07:04:41 | pgsql: Fix attribute name of pg_stat_get_backend_subxact() |