aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/xml.c')
-rw-r--r--src/backend/utils/adt/xml.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 48d98e96cf5..edac2754aba 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -4612,6 +4612,12 @@ XmlTableGetValue(TableFuncScanState *state, int colnum,
xmlChar *str;
xmlNodePtr node;
+ node = xpathobj->nodesetval->nodeTab[0];
+ if (node->type == XML_NAMESPACE_DECL)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("XMLTABLE cannot cast a namespace node to a non-XML result type")));
+
/*
* Most nodes (elements and even attributes) store their data
* in children nodes. If they don't have children nodes, it
@@ -4619,7 +4625,6 @@ XmlTableGetValue(TableFuncScanState *state, int colnum,
* CDATA sections are an exception: they don't have children
* but have content in the Text/CDATA node itself.
*/
- node = xpathobj->nodesetval->nodeTab[0];
if (node->type != XML_CDATA_SECTION_NODE &&
node->type != XML_TEXT_NODE)
node = node->xmlChildrenNode;