Re: [PATCH] Add pretty-printed XML output option
Nikolay Samokhvalov <samokhvalov@gmail.com>
From: Nikolay Samokhvalov <samokhvalov@gmail.com>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Peter Smith <smithpb2250@gmail.com>, Andrey Borodin <amborodin86@gmail.com>
Date: 2023-02-22T07:05:38Z
Lists: pgsql-hackers
On Mon, Feb 20, 2023 at 3:06 PM Jim Jones <jim.jones@uni-muenster.de> wrote:
> As suggested by Peter and Nikolay, v15 now removes the xmlformat
> function from the catalog and adds the [NO] INDENT option to
> xmlserialize, as described in X069.\
>
Great. I'm checking this patch and it seems, indentation stops working if
we have a text node inside:
gitpod=# select xmlserialize(document '<xml><more>13</more></xml>' as text
indent);
xmlserialize
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>+
<xml> +
<more>13</more> +
</xml> +
(1 row)
gitpod=# select xmlserialize(document '<xml>text<more>13</more></xml>' as
text indent);
xmlserialize
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>+
<xml>text<more>13</more></xml> +
(1 row)
Worth to mention, Oracle behaves similarly -- indentation doesn't work:
https://dbfiddle.uk/hRz5sXdM.
But is this as expected? Shouldn't it be like this:
<xml>
text
<more>13</more>
</xml>
?
Commits
-
Fix memory leak in XMLSERIALIZE(... INDENT).
- f24605e2dc16 18.0 landed
- ee58de10084b 16.10 landed
- 20bae0690322 17.6 landed
-
doc: Move documentation of md5_password_warnings to a better place
- f3622b64762b 18.0 cited
-
Support [NO] INDENT option in XMLSERIALIZE().
- 483bdb2afec9 16.0 landed
-
Add an expected-file to match behavior of latest libxml2.
- 085423e3e326 9.6.0 cited