Re: possible bug - xmlconcat is badly marked as immutable

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: possible bug - xmlconcat is badly marked as immutable
Date: 2026-11-04 14:59:17
Message-ID: CAFj8pRCmnjbxKPFnpU=FbugHJ6bK-P=HQ4LSoDDDni7U+SM3Vw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

st 4. 11. 2026 v 13:54 odesílatel Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
napsal:

> Hi Pavel
>
> On 04/11/2026 09:42, Pavel Stehule wrote:
> > I don't understand why IS_XMLCONCAT is marked as immutable. In this
> > case, the result should depend on arguments, and arguments can be stable.
>
> I'd say that it's because it will always return the same result for the
> same inputs. If any argument is not immutable, the whole expression is
> not immutable either:
>
> psql (20devel)
> Type "help" for help.
>
> postgres=# create table t1 (foo xml, bar xml generated always as
> (xmlconcat(foo,'<a/>')) stored);
> CREATE TABLE
>
> postgres=# create table t2 (foo xml, bar xml generated always as
> (xmlconcat(foo,now()::text::xml)) stored);
> ERROR: generation expression is not immutable
>

yes, it is correct. I was confused (and the name of the function is little
bit confusing)

When xmlexpr_is_immutable returns false, then it means - yes, the
expression is 100% mutable. When returned true, it means - know nothing,
check arguments - continue in node walking.

After some time it is hard to return to work with reversed logic in walker
iterators.

Regards

Pavel

> Best, Jim
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-11-04 14:59:38 Re: Hash index corruption and CLOG lookup errors from checkpoint races
Previous Message Manu 2026-11-04 14:57:49 Re: PG19 regression in ecd9288624a: JSON_ARRAY() indexes that go stale