agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Richard Guo <rguo@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't let JSON constructor coercions block SQL function inlining
Date: Mon, 14 Sep 2026 08:09:57 +0000
Message-ID: <E1x61lF-00000000G0o-1tw4@gemulon.postgresql.org> (raw)
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(-)
view thread (2+ messages)
Message-ID: <E1x61lF-00000000G0o-1tw4@gemulon.postgresql.org>
Permalink: ../E1x61lF-00000000G0o-1tw4@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x61lF-00000000G0o-1tw4@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: rguo@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Don't let JSON constructor coercions block SQL function inlining
In-Reply-To: <E1x61lF-00000000G0o-1tw4@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox