agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Handle XmlExpr more honestly in clauses.c.
Date: Tue, 01 Sep 2026 16:17:20 +0000
Message-ID: <E1x1RAl-000000033jT-0Dao@gemulon.postgresql.org> (raw)
Handle XmlExpr more honestly in clauses.c.
eval_const_expressions() didn't constant-fold XmlExpr. In some cases
it cannot, but often it can. Failure to do so can cause visible
regressions in SQL-language function behavior compared to pre-v18,
though only in a rather narrow set of contexts: basically, if you're
trying to use a CASE to prevent evaluation of a failure-prone XML
function.
While we're at it, make contain_mutable_functions() handle XmlExpr
more precisely, and adjust some comments that justify not treating
XmlExpr explicitly.
This seems worth sneaking into v19, but I'm hesitant to put it into
v18. It's not really a bug fix, because we disclaim the safety of
using CASE this way, and it carries some risk of de-optimizing queries
that worked satisfactorily before.
Bug: #19487
Reported-by: Ilya Portnov <i.portnov@compassplus.com>
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19487-367258bc497b923a@postgresql.org
Backpatch-through: 19
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/14dbc85985357c0d6485dab8dd64fac02c91d207
Modified Files
--------------
src/backend/optimizer/util/clauses.c | 83 +++++++++++++++++++++++++++++++-----
src/test/regress/expected/xml.out | 11 +++++
src/test/regress/sql/xml.sql | 7 +++
3 files changed, 90 insertions(+), 11 deletions(-)
view thread (2+ messages) latest in thread
Message-ID: <E1x1RAl-000000033jT-0Dao@gemulon.postgresql.org>
Permalink: ../E1x1RAl-000000033jT-0Dao@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x1RAl-000000033jT-0Dao@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: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Handle XmlExpr more honestly in clauses.c.
In-Reply-To: <E1x1RAl-000000033jT-0Dao@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