agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Handle XmlExpr more honestly in clauses.c. 2+ messages / 1 participants [nested] [flat]
* pgsql: Handle XmlExpr more honestly in clauses.c. @ 2026-09-01 16:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2026-09-01 16:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Handle XmlExpr more honestly in clauses.c. @ 2026-09-01 16:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2026-09-01 16:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f3ac68ffe38692582c24880ef10cc365ec683fa6 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(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-09-01 16:17 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-09-01 16:17 pgsql: Handle XmlExpr more honestly in clauses.c. Tom Lane <tgl@sss.pgh.pa.us> 2026-09-01 16:17 pgsql: Handle XmlExpr more honestly in clauses.c. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox