Re: [PATCH] Add pretty-printed XML output option - Mailing list pgsql-hackers

From Nikolay Samokhvalov
Subject Re: [PATCH] Add pretty-printed XML output option
Date
Msg-id CANNMO+Kix1DRRa7m4o07qgRHh=0vOiO_x+_PsHOkQvT4GgLrLA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Add pretty-printed XML output option  (Jim Jones <jim.jones@uni-muenster.de>)
Responses Re: [PATCH] Add pretty-printed XML output option
List 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>
?

pgsql-hackers by date:

Previous
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Allow logical replication to copy tables in binary format
Next
From: Peter Smith
Date:
Subject: Re: [PATCH] Add pretty-printed XML output option