xpath insert unexpected newlines
xpath insert unexpected newlines
Hello guys,
It seems that xpath function add unexpected newlines in the xml elements it returns as array:
postgres=> select version();
version
------------------------------------------------------------
PostgreSQL 10.3, compiled by Visual C++ build 1800, 64-bit
(1 row)
postgres=> select ((xpath('/*',xml('<root><a/><b/><c/></root>')))[1])::text;
xpath
---------
<root> +
<a/> +
<b/> +
<c/> +
</root>
(1 row)
A workaround is to have at least one element with a value:
postgres=> select ((xpath('/*',xml('<root><a/><b/><c/>one value</root>')))[1])::text;
xpath
------------------------------------
<root><a/><b/><c/>one value</root>
(1 row)
Best regards.
This email was sent to you by Moody’s Investors Service EMEA Limited
Registered office address:
One Canada Square
Canary Wharf
London, E14 5FA
Registered in England and Wales No: 8922701