xmltable-xpath-result-review-fix.patch
text/x-patch
Filename: xmltable-xpath-result-review-fix.patch
Type: text/x-patch
Part: 0
Message:
Re: PostgreSQL vs SQL/XML Standards
Patch
Format: unified
| File | + | − |
|---|---|---|
| doc/src/sgml/func.sgml | 3 | 3 |
| src/backend/utils/adt/xml.c | 5 | 3 |
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 90d67f1acf..06f3f69073 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -10999,9 +10999,9 @@ $$ AS data;
SELECT xmltable.*
FROM xmlelements, XMLTABLE('/root' PASSING data COLUMNS element text);
- element
-----------------------
- Hello2a2 bbbCC
+ element
+-------------------------
+ Hello2a2 bbbxxxCC
]]></screen>
</para>
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index a83882f5de..df7f0cc20d 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -4427,6 +4427,7 @@ XmlTableFetchRow(TableFuncScanState *state)
#endif /* not USE_LIBXML */
}
+#ifdef USE_LIBXML
/*
* Copy XmlChar string to PostgreSQL memory. Ensure releasing of
* source xmllib string.
@@ -4455,6 +4456,7 @@ copy_and_safe_free_xmlchar(xmlChar *str)
return result;
}
+#endif
/*
* XmlTableGetValue
@@ -4504,9 +4506,9 @@ XmlTableGetValue(TableFuncScanState *state, int colnum,
/*
* There are four possible cases, depending on the number of nodes
* returned by the XPath expression and the type of the target column:
- * a) XPath returns no nodes. b) One node is returned, and column is
- * of type XML. c) One node, column type other than XML. d) Multiple
- * nodes are returned.
+ * a) XPath returns no nodes. b) The target type is XML (return all
+ * as XML). For non-XML types: c) One node (return content).
+ * d) Multiple nodes (error).
*/
if (xpathobj->type == XPATH_NODESET)
{