possible bug - xmlconcat is badly marked as immutable

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: possible bug - xmlconcat is badly marked as immutable
Date: 2026-11-04 08:42:22
Message-ID: CAFj8pRDHmEQm62akUPa_=pCMfY_2bOx3bgyJcmZApdCqmUojhA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

xmlexpr_is_immutable(XmlExpr *xexpr)
{
switch (xexpr->op)
{
case IS_XMLCONCAT:
case IS_XMLPARSE:
case IS_XMLPI:
case IS_XMLROOT:
case IS_XMLSERIALIZE:
case IS_DOCUMENT:
/* These variants manipulate XML text in a self-contained way */
return true;

case IS_XMLELEMENT:
case IS_XMLFOREST:

/*
* These variants invoke I/O conversion functions for a wide
range
* of data types, and have various special rules too, so in some
* cases they are only stable. In principle we could analyze
* their behavior precisely, but keeping such code in sync with
* the actual implementation seems like more maintenance risk
than
* it's worth.
*/
return false;

/* There is intentionally no default: case here */
}
/* We shouldn't get here, but if we do, say "not immutable" */
return false;
}

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.

Regards

Pavel

Browse pgsql-hackers by date

  From Date Subject
Next Message Rahila Syed 2026-11-04 08:43:25 Re: Stale hash entries when reusing an auxiliary resource owner
Previous Message Bertrand Drouvot 2026-11-04 08:37:48 Re: Fix ReadStream handling when heap rescan strategy changes