Re: BUG #19487: Error while executing SQL query involving XML parsing

From: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: i(dot)portnov(at)compassplus(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19487: Error while executing SQL query involving XML parsing
Date: 2026-08-28 19:55:37
Message-ID: CAB8bMitYCBLs16zVzNLgB34go2s4p9mraGsvcuDeUKyO+a4=cA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

сб, 29 авг. 2026 г. в 00:49, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com> 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
> --------------------------------------
> <foo>2026-08-28T08:00:00-04:00</foo>
> (1 row)
>
> regression=# set timezone = 'America/Chicago';
> SET
> regression=# SELECT xmlforest('2026-08-28 12:00 UTC'::timestamptz AS foo);
> xmlforest
> --------------------------------------
> <foo>2026-08-28T07:00:00-05:00</foo>
> (1 row)
>
> So you need to take a closer look at which variants can be promised to
> be immutable.
>
>
> Dear Tom,

Thanks for the review. I'll study it in more detail and come back with
corrections.

--
Regards,
Rachitskiy Andrey

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Gustafsson 2026-08-28 22:31:16 Re: autovacuum: automatically propagate updated parameters
Previous Message Tom Lane 2026-08-28 19:49:13 Re: BUG #19487: Error while executing SQL query involving XML parsing