Re: possible bug - xmlconcat is badly marked as immutable

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: possible bug - xmlconcat is badly marked as immutable
Date: 2026-11-04 12:54:58
Message-ID: d0d45aea-282d-42d2-b686-b570fb5cab78@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Best, Jim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ayoub Kazar 2026-11-04 12:58:01 Fix exclude generated columns in COPY TO with RLS
Previous Message Zhijie Hou 2026-11-04 12:50:11 Re: Avoid resetting subscription two_phase state to pending when already enabled