Reputation: 2383
I have a little problem with creating xml with double quoted column aliases. When converting to xml using double quotes I've got Unicode values on output (eg. _x0020 for space).
Executing this:
SELECT xmlforest('abc' AS " ", 123 AS bar);
Gives me:
<_x0020__x0020__x0020_>abc</_x0020__x0020__x0020_><bar>123</bar>
How can I avoid xml Unicode values in output xml?
Upvotes: 0
Views: 395
Reputation: 5525
You cannot have space in tag: https://www.w3.org/TR/REC-xml/#NT-STag
Postgres is replacing
for you to have text processors properly consume such xml.
I assume you don't need spaces in tags, such example works perfectly ok:
# SELECT xmlforest('abc' AS "Tag", 123 AS bar);
xmlforest
------------------------------
<Tag>abc</Tag><bar>123</bar>
Upvotes: 2