public inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedFrom: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: a.prototype7@gmail.com
Subject: BUG #19486: Regression in SQL-language functions using XML values and IS DOCUMENT
Date: Mon, 18 May 2026 07:54:29 +0000
Message-ID: <19486-f1cbfe2bd1c9c3d9@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 19486
Logged by: Artem Zarubin
Email address: a.prototype7@gmail.com
PostgreSQL version: 18.4
Operating system: Debian 13
Description:
Hello, I found a regression in SQL-language functions using XML values and
`IS DOCUMENT`.
Tested commits:
bad: 98dd6c2046965e51da015681e81c20109be46d71, PostgreSQL 18.4
bad: 5107398e6d5ecad96f3d1c0efcfc9aa02b9cdff9, PostgreSQL 19devel
good: e9e7b66044c9e3dfa76fd1599d5703acd3e4a3f5, parent of 0dca5d68
PostgreSQL 18devel before SQL-function plan cache changes
The server was configured with:
./configure --enable-tap-tests --enable-debug --enable-cassert
--with-libxml
SQL-script to reproduce:
CREATE OR REPLACE FUNCTION xml_to_text_no_inline(pXml xml) RETURNS text
LANGUAGE sql
IMMUTABLE
SET search_path = pg_catalog
AS $$
SELECT CASE WHEN pXml IS DOCUMENT
THEN (xpath('/*/text()', pXml))[1]::text
ELSE pXml::text
END;
$$;
SELECT xml_to_text_no_inline(XMLPARSE(CONTENT '2019-12-16T00:00:00.000'));
Expected result:
2019-12-16T00:00:00.000
Actual result:
ERROR: could not parse XML document
DETAIL: line 1: Start tag expected, '<' not found
2019-12-16T00:00:00.000
^
CONTEXT: SQL function "xpath" statement 1
SQL function "xml_to_text_no_inline" statement 1
---
Best regards,
Artem Zarubin
Postgres Professional: https://postgrespro.com/
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, a.prototype7@gmail.com
Subject: Re: BUG #19486: Regression in SQL-language functions using XML values and IS DOCUMENT
In-Reply-To: <19486-f1cbfe2bd1c9c3d9@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox