Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc06e355

Browse files
committed
Don't request pretty-printed output from xmlNodeDump().
xml.c passed format = 1 to xmlNodeDump(), resulting in sometimes gettingextra whitespace (newlines + spaces) in the output. We don't really wantthat, first because whitespace might be semantically significant in someXML uses, and second because it happens only very inconsistently. Onlyone case in our regression tests is affected.This potentially affects the results of xpath() and the XMLTABLE construct,when emitting nodeset values.Note that the older code in contrib/xml2 doesn't do this; it seemsto have been an aboriginal bad decision in commitea3b212.While this definitely seems like a bug to me, the small number ofcomplaints to date argues against back-patching a behavioral change.Hence, fix in HEAD only, at least for now.Per report from Jean-Marc Voillequin.Discussion:https://postgr.es/m/1EC8157EB499BF459A516ADCF135ADCE3A23A9CA@LON-WGMSX712.ad.moodys.net
1 parentccae190 commitc06e355

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

‎src/backend/utils/adt/xml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3857,7 +3857,7 @@ xml_xmlnodetoxmltype(xmlNodePtr cur, PgXmlErrorContext *xmlerrcxt)
38573857
nodefree= (cur_copy->type==XML_DOCUMENT_NODE) ?
38583858
(void (*) (xmlNodePtr))xmlFreeDoc :xmlFreeNode;
38593859

3860-
bytes=xmlNodeDump(buf,NULL,cur_copy,0,1);
3860+
bytes=xmlNodeDump(buf,NULL,cur_copy,0,0);
38613861
if (bytes==-1||xmlerrcxt->err_occurred)
38623862
xml_ereport(xmlerrcxt,ERROR,ERRCODE_OUT_OF_MEMORY,
38633863
"could not dump node");

‎src/test/regress/expected/xml.out

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -654,12 +654,9 @@ SELECT xpath('//loc:piece', '<local:data xmlns:local="http://127.0.0.1"><local:p
654654
(1 row)
655655

656656
SELECT xpath('//loc:piece', '<local:data xmlns:local="http://127.0.0.1" xmlns="http://127.0.0.2"><local:piece id="1"><internal>number one</internal><internal2/></local:piece><local:piece id="2" /></local:data>', ARRAY[ARRAY['loc', 'http://127.0.0.1']]);
657-
xpath
658-
--------------------------------------------------------------------------------------
659-
{"<local:piece xmlns:local=\"http://127.0.0.1\" xmlns=\"http://127.0.0.2\" id=\"1\">+
660-
<internal>number one</internal> +
661-
<internal2/> +
662-
</local:piece>","<local:piece xmlns:local=\"http://127.0.0.1\" id=\"2\"/>"}
657+
xpath
658+
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
659+
{"<local:piece xmlns:local=\"http://127.0.0.1\" xmlns=\"http://127.0.0.2\" id=\"1\"><internal>number one</internal><internal2/></local:piece>","<local:piece xmlns:local=\"http://127.0.0.1\" id=\"2\"/>"}
663660
(1 row)
664661

665662
SELECT xpath('//b', '<a>one <b>two</b> three <b>etc</b></a>');

‎src/test/regress/expected/xml_2.out

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -634,12 +634,9 @@ SELECT xpath('//loc:piece', '<local:data xmlns:local="http://127.0.0.1"><local:p
634634
(1 row)
635635

636636
SELECT xpath('//loc:piece', '<local:data xmlns:local="http://127.0.0.1" xmlns="http://127.0.0.2"><local:piece id="1"><internal>number one</internal><internal2/></local:piece><local:piece id="2" /></local:data>', ARRAY[ARRAY['loc', 'http://127.0.0.1']]);
637-
xpath
638-
--------------------------------------------------------------------------------------
639-
{"<local:piece xmlns:local=\"http://127.0.0.1\" xmlns=\"http://127.0.0.2\" id=\"1\">+
640-
<internal>number one</internal> +
641-
<internal2/> +
642-
</local:piece>","<local:piece xmlns:local=\"http://127.0.0.1\" id=\"2\"/>"}
637+
xpath
638+
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
639+
{"<local:piece xmlns:local=\"http://127.0.0.1\" xmlns=\"http://127.0.0.2\" id=\"1\"><internal>number one</internal><internal2/></local:piece>","<local:piece xmlns:local=\"http://127.0.0.1\" id=\"2\"/>"}
643640
(1 row)
644641

645642
SELECT xpath('//b', '<a>one <b>two</b> three <b>etc</b></a>');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp