Re: Use \if/\endif to remove non-libxml2 expected output in regression tests

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Michael Paquier <michael@paquier.xyz>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-06-12T14:22:37Z
Lists: pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes:
>> On 12 Jun 2026, at 09:49, Michael Paquier <michael@paquier.xyz> wrote:
>> I'd like to backpatch that down to v14, to ease future maintenance.
>> Any comments and/or objections?

> Skipping tests when the underlying library/platform support is missing is in
> line with how the TAP tests already do it.  We would lose coverage of invoking
> XML functions without libxml support, which risk hiding bugs in the error-
> handling (which is already the case with the TAP tests etc).

Yeah.  Also, I think this isn't really moving the support goalposts
very far, because xml_2.out will still require maintenance whenever
we touch xml.out, and that's the harder file to update if you don't
have a suitable version of libxml2 at hand.  So I'm not in favor of
this as it stands.  If we could find a way to get rid of xml_2.out
as well, then maybe dropping coverage of the error paths would be a
good tradeoff.

Diff'ing xml.out and xml_2.out, I see the differences are omissions
of input fragments in some error reports, eg:

@@ -335,8 +323,6 @@
 <twoerrors>&idontexist;</unbalanced>
                        ^
 line 1: Opening and ending tag mismatch: twoerrors line 1 and unbalanced
-<twoerrors>&idontexist;</unbalanced>
-                                    ^
 SELECT xmlparse(document '<nosuchprefix:tag/>');
       xmlparse       
 ---------------------

I wonder if anyone's ever looked into exactly why that happens and
whether we could do something to restore the missing context.

			regards, tom lane



Commits

  1. Trim regression test expected output for xml

  2. Add an expected-file to match behavior of latest libxml2.