summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/xml.result3
-rw-r--r--mysql-test/t/xml.test5
-rw-r--r--sql/item_xmlfunc.cc2
3 files changed, 9 insertions, 1 deletions
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index 3ed3df546d1..b5ed4ef8b5a 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -546,3 +546,6 @@ select extractvalue('<a>A</a>','/<a>');
ERROR HY000: XPATH syntax error: '>'
select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
ERROR HY000: XPATH syntax error: '!'
+select extractvalue('<A_B>A</A_B>','/A_B');
+extractvalue('<A_B>A</A_B>','/A_B')
+A
diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test
index e69ab5ee58b..fa7599df898 100644
--- a/mysql-test/t/xml.test
+++ b/mysql-test/t/xml.test
@@ -243,3 +243,8 @@ select extractvalue('<a>A</a>','/<a>');
#
--error 1105
select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
+
+#
+# Bug #16320 XML: extractvalue() won't accept names containing underscores
+#
+select extractvalue('<A_B>A</A_B>','/A_B');
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index aad9e12f6c5..61f7579fa22 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -1272,7 +1272,7 @@ my_xident_body(int c)
return (((c) >= 'a' && (c) <= 'z') ||
((c) >= 'A' && (c) <= 'Z') ||
((c) >= '0' && (c) <= '9') ||
- ((c)=='-'));
+ ((c)=='-') || ((c) == '_'));
}