diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index dae7d5883b5..48b8034f8d0 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -3857,7 +3857,7 @@ xml_xmlnodetoxmltype(xmlNodePtr cur, PgXmlErrorContext *xmlerrcxt)
nodefree = (cur_copy->type == XML_DOCUMENT_NODE) ?
(void (*) (xmlNodePtr)) xmlFreeDoc : xmlFreeNode;
- bytes = xmlNodeDump(buf, NULL, cur_copy, 0, 1);
+ bytes = xmlNodeDump(buf, NULL, cur_copy, 0, 0);
if (bytes == -1 || xmlerrcxt->err_occurred)
xml_ereport(xmlerrcxt, ERROR, ERRCODE_OUT_OF_MEMORY,
"could not dump node");
diff --git a/src/test/regress/expected/xml.out b/src/test/regress/expected/xml.out
index 0aae60016bc..11e7d7faf37 100644
--- a/src/test/regress/expected/xml.out
+++ b/src/test/regress/expected/xml.out
@@ -654,12 +654,9 @@ SELECT xpath('//loc:piece', 'number one', ARRAY[ARRAY['loc', 'http://127.0.0.1']]);
- xpath
---------------------------------------------------------------------------------------
- {"+
- number one +
- +
- ",""}
+ xpath
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ {"number one",""}
(1 row)
SELECT xpath('//b', 'one two three etc');
diff --git a/src/test/regress/expected/xml_2.out b/src/test/regress/expected/xml_2.out
index 9756b6e8865..4d200274691 100644
--- a/src/test/regress/expected/xml_2.out
+++ b/src/test/regress/expected/xml_2.out
@@ -634,12 +634,9 @@ SELECT xpath('//loc:piece', 'number one', ARRAY[ARRAY['loc', 'http://127.0.0.1']]);
- xpath
---------------------------------------------------------------------------------------
- {"+
- number one +
- +
- ",""}
+ xpath
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ {"number one",""}
(1 row)
SELECT xpath('//b', 'one two three etc');