| 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-29 10:54:42 |
| Message-ID: | CAB8bMisnPP=Ck=BX4UfHL1eTFLMFJ_RznsVXtqy3H=P+6tugjg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
сб, 29 авг. 2026 г. в 00:55, Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>:
>
>
> сб, 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, have a nice weekend!
In v2, I tried to take all the points into account and expanded the tests.
--
Regards,
Rachitskiy Andrey
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Fold-immutable-XmlExpr-forms-in-eval_const_expressions.patch | text/x-patch | 9.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-08-29 21:44:31 | Re: BUG #19487: Error while executing SQL query involving XML parsing |
| Previous Message | PG Bug reporting form | 2026-08-29 05:39:49 | BUG #19646: Unique index with explicit COLLATE bypasses nondeterministic collation rule |