pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: zengman <zengman@halodbtech.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Erik Wienhold <ewie@ewie.name>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Regression with large XML data input
Date: Mon, 29 Dec 2025 18:43:00 +0800
Message-ID: <tencent_0AB6B991075B81CC498CB803@qq.com> (raw)
In-Reply-To: <2744536.1766980472@sss.pgh.pa.us>
References: <aIGknLuc8b8ega2X@paquier.xyz>
	<586b74bb-8941-420f-82c4-ba93e5b42b20@ewie.name>
	<tencent_2789D934383FA63637EFDB9E@qq.com>
	<89bbd852-eea9-42e8-bab6-bb8df59685de@ewie.name>
	<1411819.1766685038@sss.pgh.pa.us>
	<aVHKPeYX3csE1Jwg@paquier.xyz>
	<2744536.1766980472@sss.pgh.pa.us>

> [ thinks... ]  Actually, I believe we do have precedents in configure
> for checking to see if a construct produces a warning, so we could
> check to see if a reference to xmlKeepBlanksDefault draws one, and
> only add -Wno-deprecated-declarations if it does.  But I'm not sure
> how to do that in meson.

Hi,

I've tried reworking this and attached the updated diff file here. Since I rarely work on this part of the code, 
I'm not entirely sure if it's fully correct ― but the functionality seems to work fine in testing.Additionally, 
I'm not very familiar with Meson either, so I haven't made any changes to the relevant parts here.

```
postgres@zxm-VMware-Virtual-Platform:~/code/postgres$ env | grep COPT
COPT=-Werror
postgres@zxm-VMware-Virtual-Platform:~/code/postgres$ make -j8 > /dev/null
postgres@zxm-VMware-Virtual-Platform:~/code/postgres$ 
```

--
Regards,
Man Zeng
www.openhalo.org

Attachments:

  [application/octet-stream] xml_keep_blanks_deprecation.diff (3.4K, ../tencent_0AB6B991075B81CC498CB803@qq.com/2-xml_keep_blanks_deprecation.diff)
  download | inline diff:
diff --git a/configure b/configure
index 14ad0a5006f..6b4dd7c16a1 100755
--- a/configure
+++ b/configure
@@ -706,6 +706,7 @@ with_lz4
 with_zlib
 with_system_tzdata
 with_libxslt
+XML_KEEP_BLANKS_DEPRECATED
 XML2_LIBS
 XML2_CFLAGS
 XML2_CONFIG
@@ -14174,6 +14175,34 @@ else
   as_fn_error $? "header file <libxml/parser.h> is required for XML support" "$LINENO" 5
 fi
 
+  # Check if xmlKeepBlanksDefault triggers a deprecation warning
+  pgac_cv_xml_keep_blanks_deprecated=no
+  if test "$GCC" = yes; then
+    { $as_echo "$as_me:${as_lineno[$LINENO]}: checking whether xmlKeepBlanksDefault is deprecated" >&5
+$as_echo_n "checking whether xmlKeepBlanksDefault is deprecated... " >&6; }
+    pgac_save_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS -Werror=deprecated-declarations"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <libxml/parser.h>
+int
+main ()
+{
+xmlKeepBlanksDefault(0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+else
+  pgac_cv_xml_keep_blanks_deprecated=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    CFLAGS=$pgac_save_CFLAGS
+    { $as_echo "$as_me:${as_lineno[$LINENO]}: result: $pgac_cv_xml_keep_blanks_deprecated" >&5
+$as_echo "$pgac_cv_xml_keep_blanks_deprecated" >&6; }
+  fi
+  XML_KEEP_BLANKS_DEPRECATED=$pgac_cv_xml_keep_blanks_deprecated
 
 fi
 
diff --git a/configure.ac b/configure.ac
index 01b3bbc1be8..649d5992bf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1603,6 +1603,20 @@ fi
 
 if test "$with_libxml" = yes ; then
   AC_CHECK_HEADER(libxml/parser.h, [], [AC_MSG_ERROR([header file <libxml/parser.h> is required for XML support])])
+  # Check if xmlKeepBlanksDefault triggers a deprecation warning
+  pgac_cv_xml_keep_blanks_deprecated=no
+  if test "$GCC" = yes; then
+    AC_MSG_CHECKING([whether xmlKeepBlanksDefault is deprecated])
+    pgac_save_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS -Werror=deprecated-declarations"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <libxml/parser.h>],
+                                       [xmlKeepBlanksDefault(0);])],
+                      [],
+                      [pgac_cv_xml_keep_blanks_deprecated=yes])
+    CFLAGS=$pgac_save_CFLAGS
+    AC_MSG_RESULT([$pgac_cv_xml_keep_blanks_deprecated])
+  fi
+  AC_SUBST(XML_KEEP_BLANKS_DEPRECATED, [$pgac_cv_xml_keep_blanks_deprecated])
 fi
 
 if test "$with_libxslt" = yes ; then
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 371cd7eba2c..a9f94d84cbf 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -278,6 +278,7 @@ CFLAGS_VECTORIZE = @CFLAGS_VECTORIZE@
 CFLAGS_CRC = @CFLAGS_CRC@
 PERMIT_DECLARATION_AFTER_STATEMENT = @PERMIT_DECLARATION_AFTER_STATEMENT@
 PERMIT_MISSING_VARIABLE_DECLARATIONS = @PERMIT_MISSING_VARIABLE_DECLARATIONS@
+XML_KEEP_BLANKS_DEPRECATED = @XML_KEEP_BLANKS_DEPRECATED@
 CXXFLAGS = @CXXFLAGS@
 
 LLVM_CPPFLAGS = @LLVM_CPPFLAGS@
diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefile
index ba40ada11ca..a25ba8b89a3 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}
 
+# Suppress deprecation warning for xmlKeepBlanksDefault
+ifeq ($(XML_KEEP_BLANKS_DEPRECATED), yes)
+xml.o: CFLAGS += -Wno-deprecated-declarations
+endif
+
 varlena.o: varlena.c levenshtein.c
 
 include $(top_srcdir)/src/backend/common.mk


view thread (36+ messages)

Message-ID: <tencent_0AB6B991075B81CC498CB803@qq.com>
Permalink:  ../tencent_0AB6B991075B81CC498CB803@qq.com/
Also on:    postgresql.org/message-id/tencent_0AB6B991075B81CC498CB803@qq.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-hackers@postgresql.org
  Cc: zengman@halodbtech.com, tgl@sss.pgh.pa.us, michael@paquier.xyz, ewie@ewie.name, pgsql-hackers@lists.postgresql.org
  Subject: Re: Regression with large XML data input
  In-Reply-To: <tencent_0AB6B991075B81CC498CB803@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