From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: mark.drake@golden-hind.com
Subject: BUG #15517: JSONB_BUILD_ARRAY and JSON_BUILD_ARRAY omit XML Declaration (if present) from XML colums
Date: Thu, 22 Nov 2018 18:40:08 +0000
Message-ID: <15517-f8fdb2e6b238eed0@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15517
Logged by: Mark Drake
Email address: mark.drake@golden-hind.com
PostgreSQL version: 11.1
Operating system: Windows
Description:
postgres=# create table foo(x xml);
CREATE TABLE
postgres=# insert into foo values ('<XYZ>XXX</XYZ>');
INSERT 0 1
postgres=# insert into foo values ('<?xml
version="1.0"?><ABC>123</ABC>'::XML);
INSERT 0 1
postgres=# select x, x::text, JSONB_BUILD_ARRAY(x,x::text) from foo;
x | x |
jsonb_build_array
----------------+-------------------------------------+-------------------------------------------------------------
<XYZ>XXX</XYZ> | <XYZ>XXX</XYZ> | ["<XYZ>XXX</XYZ>",
"<XYZ>XXX</XYZ>"]
<ABC>123</ABC> | <?xml version="1.0"?><ABC>123</ABC> | ["<ABC>123</ABC>",
"<?xml version=\"1.0\"?><ABC>123</ABC>"]
(2 rows)
As can be seen the JSONB_BUILD_ARRAY of x has omitted the declaration. I
would have expected the declaration to be included in the output for column
X.
As can be seen a simple workaround is to generate based on the casting to
text. Not sure how much overhead (if any) this adds.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, mark.drake@golden-hind.com
Subject: Re: BUG #15517: JSONB_BUILD_ARRAY and JSON_BUILD_ARRAY omit XML Declaration (if present) from XML colums
In-Reply-To: <15517-f8fdb2e6b238eed0@postgresql.org>
References: <15517-f8fdb2e6b238eed0@postgresql.org>
* 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