agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Don't let JSON constructor coercions block SQL function inlining 2+ messages / 1 participants [nested] [flat]
* pgsql: Don't let JSON constructor coercions block SQL function inlining @ 2026-09-14 08:09 Richard Guo <rguo@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Richard Guo @ 2026-09-14 08:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@gmail.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(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Don't let JSON constructor coercions block SQL function inlining @ 2026-09-14 08:09 Richard Guo <rguo@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Richard Guo @ 2026-09-14 08:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@gmail.com> Discussion: https://postgr.es/m/CAMbWs48A=VCFbteTkuCoknO1_0-Cu0aMBT0M07dm7vj1QyixDg@mail.gmail.com Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9e9dc104badf49c1f2e536ca3468e0f64f9a44a5 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(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-09-14 08:09 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-09-14 08:09 pgsql: Don't let JSON constructor coercions block SQL function inlining Richard Guo <rguo@postgresql.org> 2026-09-14 08:09 pgsql: Don't let JSON constructor coercions block SQL function inlining Richard Guo <rguo@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox