summaryrefslogtreecommitdiff
path: root/mysql-test/main/ctype_utf16.test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2020-05-20 11:53:09 +0400
committerAlexander Barkov <bar@mariadb.com>2020-05-20 11:53:09 +0400
commitd4f97e2086848cedfdd35a6c1cf286f8dad26c5c (patch)
tree0395f96dd3a403f94285ccab1515913802211f7a /mysql-test/main/ctype_utf16.test
parent294ac1fbab306e97dad3588a00e3527f2056e7e4 (diff)
downloadmariadb-git-d4f97e2086848cedfdd35a6c1cf286f8dad26c5c.tar.gz
MDEV-22391 Assertion `0' failed in Item_type_holder::val_str on utf16 charset table query
Problem: When handling a query like this: VALUES ('') UNION SELECT _utf16 0x0020 COLLATE utf16_bin; Type_handler_string_result::Item_hybrid_func_fix_attributes() tried to apply character set conversion Item_type_holder, which causes a crash on DBUG_ASSERT(0) inside Item_type_holder::val_str(). Fix: Overriding Item_type_holder's methods to avoid this, as follows: bool const_item() const { return false; } bool is_expensive() { return true; }
Diffstat (limited to 'mysql-test/main/ctype_utf16.test')
-rw-r--r--mysql-test/main/ctype_utf16.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/main/ctype_utf16.test b/mysql-test/main/ctype_utf16.test
index 0e497b7b7bd..536a63ceeb4 100644
--- a/mysql-test/main/ctype_utf16.test
+++ b/mysql-test/main/ctype_utf16.test
@@ -934,3 +934,24 @@ let $coll_pad='utf16_bin';
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # Start of 10.3 tests
+--echo #
+
+--echo #
+--echo # MDEV-22391 Assertion `0' failed in Item_type_holder::val_str on utf16 charset table query
+--echo #
+
+SET NAMES utf8;
+CREATE TABLE t1 (a TEXT CHARACTER SET utf16);
+SELECT * FROM (VALUES (1) UNION SELECT * FROM t1) AS t;
+DROP TABLE t1;
+VALUES (1) UNION SELECT _utf16 0x0020;
+VALUES ('') UNION SELECT _utf16 0x0020 COLLATE utf16_bin;
+VALUES ('') UNION VALUES ( _utf16 0x0020 COLLATE utf16_bin);
+
+
+--echo #
+--echo # End of 10.3 tests
+--echo #