diff --git a/mysql-test/main/ctype_binary.result b/mysql-test/main/ctype_binary.result index b736589199b..118a55cd5ee 100644 --- a/mysql-test/main/ctype_binary.result +++ b/mysql-test/main/ctype_binary.result @@ -807,12 +807,12 @@ create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL + `c1` varbinary(36) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) -4 2 +5 2 select charset(concat(uuid(), cast('a' as char character set latin1))); charset(concat(uuid(), cast('a' as char character set latin1))) latin1 diff --git a/mysql-test/main/ctype_cp1251.result b/mysql-test/main/ctype_cp1251.result index 03a0d413023..9f11301f63b 100644 --- a/mysql-test/main/ctype_cp1251.result +++ b/mysql-test/main/ctype_cp1251.result @@ -1216,12 +1216,12 @@ create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(36) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) -4 2 +5 2 select charset(concat(uuid(), cast('a' as char character set latin1))); charset(concat(uuid(), cast('a' as char character set latin1))) latin1 diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 4362ed44699..b78a42694cf 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -1525,12 +1525,12 @@ create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(36) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) -4 2 +5 2 select charset(concat(uuid(), cast('a' as char character set latin1))); charset(concat(uuid(), cast('a' as char character set latin1))) latin1 diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index fba779f5881..41c3ecab4c4 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -2409,12 +2409,12 @@ create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(36) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) -4 2 +5 2 select charset(concat(uuid(), cast('a' as char character set latin1))); charset(concat(uuid(), cast('a' as char character set latin1))) latin1 diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index d044fe6e430..fba7bda67fd 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -3281,7 +3281,7 @@ t1 CREATE TABLE `t1` ( drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) -4 2 +5 2 select charset(concat(uuid(), cast('a' as char character set latin1))); charset(concat(uuid(), cast('a' as char character set latin1))) latin1 @@ -11341,5 +11341,12 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # +# MDEV-20890 Illegal mix of collations with UUID() +# +SET NAMES utf8 COLLATE utf8_unicode_ci; +SELECT uuid()>''; +uuid()>'' +1 +# # End of 10.5 tests # diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test index 89243a1d23d..4314a0282e5 100644 --- a/mysql-test/main/ctype_utf8.test +++ b/mysql-test/main/ctype_utf8.test @@ -2276,6 +2276,13 @@ CREATE OR REPLACE TABLE t1 AS SELECT CAST(1 AS BINARY), CAST(@a AS BINARY), CAST SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-20890 Illegal mix of collations with UUID() +--echo # + +SET NAMES utf8 COLLATE utf8_unicode_ci; +SELECT uuid()>''; + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result index a54da192e9c..38d3d927416 100644 --- a/mysql-test/main/func_misc.result +++ b/mysql-test/main/func_misc.result @@ -22,7 +22,7 @@ hex(inet_aton('127.1.1')) 7F010001 select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8''))); length(uuid()) charset(uuid()) length(unhex(replace(uuid(),_utf8'-',_utf8''))) -36 utf8 16 +36 latin1 16 set @a= uuid_short(); set @b= uuid_short(); select @b - @a; @@ -107,7 +107,7 @@ create table t1 as select uuid(), length(uuid()); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `uuid()` varchar(36) CHARACTER SET utf8 DEFAULT NULL, + `uuid()` varchar(36) DEFAULT NULL, `length(uuid())` int(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 81f72b6bb83..e84696fe22c 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1663,8 +1663,7 @@ public: Item_func_uuid(THD *thd): Item_str_func(thd) {} bool fix_length_and_dec() { - collation.set(system_charset_info, - DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); + collation.set(DTCollation_numeric()); fix_char_length(MY_UUID_STRING_LENGTH); return FALSE; }