Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x02Zz-004PmO-1M for pgsql-bugs@arkaria.postgresql.org; Fri, 28 Aug 2026 19:49:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x02Zy-0099wC-0b for pgsql-bugs@arkaria.postgresql.org; Fri, 28 Aug 2026 19:49:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x02Zx-0099w3-2z for pgsql-bugs@lists.postgresql.org; Fri, 28 Aug 2026 19:49:33 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x02Zw-00000002tYp-1Ovh for pgsql-bugs@lists.postgresql.org; Fri, 28 Aug 2026 19:49:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 67SJnDJ41589703; Fri, 28 Aug 2026 15:49:13 -0400 From: Tom Lane To: Andrey Rachitskiy cc: i.portnov@compassplus.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19487: Error while executing SQL query involving XML parsing In-reply-to: References: <19487-367258bc497b923a@postgresql.org> Comments: In-reply-to Andrey Rachitskiy message dated "Fri, 28 Aug 2026 13:53:59 +0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1589701.1787946553.1@sss.pgh.pa.us> Date: Fri, 28 Aug 2026 15:49:13 -0400 Message-ID: <1589702.1787946553@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrey Rachitskiy writes: > # Proposal Fix > Fold constant `XmlExpr` in `eval_const_expressions` (same path as > `MinMaxExpr` / `ArrayExpr`), so `IS DOCUMENT` becomes a boolean Const and > CASE drops the unused arm before simplifying `xpath()`. I don't object to simplifying XmlExpr where possible, but this patch appears to believe that every variant of XmlExpr is immutable. This is demonstrably false, eg regression=# set timezone = 'America/New_York'; SET regression=# SELECT xmlforest('2026-08-28 12:00 UTC'::timestamptz AS foo); xmlforest -------------------------------------- 2026-08-28T08:00:00-04:00 (1 row) regression=# set timezone = 'America/Chicago'; SET regression=# SELECT xmlforest('2026-08-28 12:00 UTC'::timestamptz AS foo); xmlforest -------------------------------------- 2026-08-28T07:00:00-05:00 (1 row) So you need to take a closer look at which variants can be promised to be immutable. regards, tom lane