From: zengman <zengman@halodbtech.com>
To: Erik Wienhold <ewie@ewie.name>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: Regression with large XML data input
Date: Thu, 25 Dec 2025 15:29:04 +0800
Message-ID: <tencent_2789D934383FA63637EFDB9E@qq.com> (raw)
In-Reply-To: <586b74bb-8941-420f-82c4-ba93e5b42b20@ewie.name>
References: <aIGknLuc8b8ega2X@paquier.xyz>
<586b74bb-8941-420f-82c4-ba93e5b42b20@ewie.name>
> The whitespace can be preserved by setting xmlKeepBlanksDefault before
> parsing. See attached v2. That function is deprecated, though. But
> libxml2 uses thread-local globals, so it should be safe. Other than
> that, I see no other way to set XML_PARSE_NOBLANKS with
> xmlParseBalancedChunkMemory.
>
> [1] https://gitlab.gnome.org/GNOME/libxml2/-/blob/408bd0e18e6ddba5d18e51d52da0f7b3ca1b4421/parserInterna...
Hi everyone,
I have a small issue that needs resolving.
My environment:
```
postgres@zxm-VMware-Virtual-Platform:~$ uname -i -s -r -v
Linux 6.11.0-29-generic #29-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:29:41 UTC 2025 x86_64
postgres@zxm-VMware-Virtual-Platform:~$
postgres@zxm-VMware-Virtual-Platform:~$ xml2-config --version
2.12.7
```
After setting COPT=-Werror, compilation fails with the following errors (warnings are enforced as errors):
```
xml.c: In function ‘xml_parse’:
xml.c:1919:25: error: ‘xmlKeepBlanksDefault’ is deprecated [-Werror=deprecated-declarations]
1919 | save_keep_blanks = xmlKeepBlanksDefault(preserve_whitespace ? 1 : 0);
| ^~~~~~~~~~~~~~~~
In file included from xml.c:51:
/usr/include/libxml2/libxml/parser.h:957:17: note: declared here
957 | xmlKeepBlanksDefault (int val);
| ^~~~~~~~~~~~~~~~~~~~
xml.c:1943:25: error: ‘xmlKeepBlanksDefault’ is deprecated [-Werror=deprecated-declarations]
1943 | xmlKeepBlanksDefault(save_keep_blanks);
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/libxml2/libxml/parser.h:957:17: note: declared here
957 | xmlKeepBlanksDefault (int val);
| ^~~~~~~~~~~~~~~~~~~~
xml.c:1956:17: error: ‘xmlKeepBlanksDefault’ is deprecated [-Werror=deprecated-declarations]
1956 | xmlKeepBlanksDefault(save_keep_blanks);
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/libxml2/libxml/parser.h:957:17: note: declared here
957 | xmlKeepBlanksDefault (int val);
| ^~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
These deprecation warnings do not impact the test results in any way.
Therefore, I have attached a patch to suppress these specific warnings.
--
Regards,
Man Zeng
www.openhalo.org
Attachments:
[application/octet-stream] 0001-Suppress-deprecation-warning-for-xmlKeepBlanksDefaul.patch (1.2K, ../tencent_2789D934383FA63637EFDB9E@qq.com/2-0001-Suppress-deprecation-warning-for-xmlKeepBlanksDefaul.patch)
download | inline diff:
From 0128f701badffdab2080473e8a5b0c77ebc05a89 Mon Sep 17 00:00:00 2001
From: Man Zeng <zengman@halodbtech.com>
Date: Thu, 25 Dec 2025 15:05:46 +0800
Subject: [PATCH] Suppress deprecation warning for xmlKeepBlanksDefault() in
xml.c
xml.c uses libxml2's deprecated xmlKeepBlanksDefault() which is the only API that provides the needed functionality for content mode parsing. The warning is harmless and does not affect tests, suppress it for this file.
Author: Man Zeng <zengman@halodbtech.com>
---
src/backend/utils/adt/Makefile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefileindex ba40ada11ca..84c645d0e69 100644--- a/src/backend/utils/adt/Makefile+++ b/src/backend/utils/adt/Makefile@@ -151,6 +151,11 @@ like.o: like.c like_match.c
# Some code in numeric.c benefits from auto-vectorization
numeric.o: CFLAGS += ${CFLAGS_VECTORIZE}
+# xml.c uses libxml2's deprecated xmlKeepBlanksDefault() which is+# the only API that provides the needed functionality for content+# mode parsing. Suppress the deprecation warning for this file.+xml.o: CFLAGS += -Wno-deprecated-declarations+
varlena.o: varlena.c levenshtein.c
include $(top_srcdir)/src/backend/common.mk
--
2.45.2
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-hackers@postgresql.org
Cc: zengman@halodbtech.com, ewie@ewie.name, michael@paquier.xyz, pgsql-hackers@lists.postgresql.org, tgl@sss.pgh.pa.us
Subject: Re: Regression with large XML data input
In-Reply-To: <tencent_2789D934383FA63637EFDB9E@qq.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox