summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/xml.result7
-rw-r--r--mysql-test/t/xml.test8
-rw-r--r--sql/item_xmlfunc.h12
3 files changed, 25 insertions, 2 deletions
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index d98173dbe15..56c884343e3 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -1022,4 +1022,11 @@ NULL NULL NULL
select updatexml(NULL, NULL, NULL);
updatexml(NULL, NULL, NULL)
NULL
+CREATE TABLE t1(a INT NOT NULL);
+INSERT INTO t1 VALUES (0), (0);
+SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1'));
+1
+1
+1
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test
index 6c7d9af1b63..5ca9c7afd76 100644
--- a/mysql-test/t/xml.test
+++ b/mysql-test/t/xml.test
@@ -543,4 +543,12 @@ select updatexml(NULL, NULL, 1), updatexml(1, NULL, NULL),
updatexml(NULL, 1, NULL);
select updatexml(NULL, NULL, NULL);
+#
+# Bug #32557: order by updatexml causes assertion in filesort
+#
+CREATE TABLE t1(a INT NOT NULL);
+INSERT INTO t1 VALUES (0), (0);
+SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1'));
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index 278c98baf7c..dadbb5ccf42 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -28,8 +28,16 @@ protected:
String tmp_value, pxml;
Item *nodeset_func;
public:
- Item_xml_str_func(Item *a, Item *b): Item_str_func(a,b) {}
- Item_xml_str_func(Item *a, Item *b, Item *c): Item_str_func(a,b,c) {}
+ Item_xml_str_func(Item *a, Item *b):
+ Item_str_func(a,b)
+ {
+ maybe_null= TRUE;
+ }
+ Item_xml_str_func(Item *a, Item *b, Item *c):
+ Item_str_func(a,b,c)
+ {
+ maybe_null= TRUE;
+ }
void fix_length_and_dec();
String *parse_xml(String *raw_xml, String *parsed_xml_buf);
};