Re: [PATCH] Add pretty-printed XML output option

Jim Jones <jim.jones@uni-muenster.de>

From: Jim Jones <jim.jones@uni-muenster.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Peter Smith <smithpb2250@gmail.com>, Nikolay Samokhvalov <samokhvalov@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Andrey Borodin <amborodin86@gmail.com>
Date: 2023-03-09T18:41:29Z
Lists: pgsql-hackers
On 09.03.23 18:38, Tom Lane wrote:
> While reviewing this patch, I started to wonder why we don't eliminate
> the maintenance hassle of xml_1.out by putting in a short-circuit
> at the top of the test, similar to those in some other scripts:
>
> /* skip test if XML support not compiled in */
> SELECT '<value>one</value>'::xml;
> \if :ERROR
> \quit
> \endif
>
> (and I guess xmlmap.sql could get the same treatment).
>
> The only argument I can think of against it is that the current
> approach ensures we produce a clean error (and not, say, a crash)
> for all xml.c entry points not just xml_in.  I'm not sure how much
> that's worth though.  The compiler/linker would tell us if we miss
> compiling out every reference to libxml2.
>
> Thoughts?
>
> 			regards, tom lane

Hi Tom,

I agree it would make things easier and it could indeed save some time 
(and some CI runs ;)).

However, checking in the absence of libxml2 if an error message is 
raised, and checking if this error message is the one we expect, is IMHO 
also a very nice test. But I guess I could also live with skipping the 
whole thing.

Best, Jim

Commits

  1. Fix memory leak in XMLSERIALIZE(... INDENT).

  2. doc: Move documentation of md5_password_warnings to a better place

  3. Support [NO] INDENT option in XMLSERIALIZE().

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