Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wPV2Z-000lz0-2g for pgsql-bugs@arkaria.postgresql.org; Wed, 20 May 2026 00:44:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wPV1X-005Roj-0Z for pgsql-bugs@arkaria.postgresql.org; Wed, 20 May 2026 00:43:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wOsoe-001U1q-08 for pgsql-bugs@lists.postgresql.org; Mon, 18 May 2026 07:55:09 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wOsoc-000000009VC-1j3S for pgsql-bugs@lists.postgresql.org; Mon, 18 May 2026 07:55:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=eEEyboinenj0fwQSNum0iKn/zENUZv6ogkTnvC3aa6Q=; b=R/SafztvGtXZGu4IqG4+BKLfAE b8z8Y2v+sbshD+01NHW01akGd1ZPs37xA+7N0jue5Scb0jtc9+h3uPpHm0knD36sa8JA2oondofBy wPcGa0t804TsQoh4Q5jFacYbgCwi/xXQF30m7jJtcLYI025iAO9yA+ooRLCUyV6Yo8Fa/exvWcsjR a7QOyMPvwx/Fs0BII3yzgqdChgRGBOj9fE8PikkcxzrI4Ob+L70zZ4Cc3jQ25NYIMCYvPZM0Ua6n3 3EgPA9nmPJ86HNJDU3m49fS2w9KhtQfvBYed/Dp6yTrqyk7/0vRouhhe9ok+kC90cRMczR/2v6LzX dGDnc8Ng==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wOsoZ-000PDc-2o for pgsql-bugs@lists.postgresql.org; Mon, 18 May 2026 07:55:05 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wOsoZ-000rTu-1p for pgsql-bugs@lists.postgresql.org; Mon, 18 May 2026 07:55:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19486: Regression in SQL-language functions using XML values and IS DOCUMENT To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: a.prototype7@gmail.com Reply-To: a.prototype7@gmail.com, pgsql-bugs@lists.postgresql.org Date: Mon, 18 May 2026 07:54:29 +0000 Message-ID: <19486-f1cbfe2bd1c9c3d9@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: =20 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 =3D 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/