diff --git a/mysql-test/main/ctype_binary.result b/mysql-test/main/ctype_binary.result index 418f1c14600..8dd7b176727 100644 --- a/mysql-test/main/ctype_binary.result +++ b/mysql-test/main/ctype_binary.result @@ -423,7 +423,7 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) -34 +35 create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table @@ -811,7 +811,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)) -5 2 +6 4 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_collate.result b/mysql-test/main/ctype_collate.result index 9f2eca8e726..15a2816766f 100644 --- a/mysql-test/main/ctype_collate.result +++ b/mysql-test/main/ctype_collate.result @@ -514,7 +514,7 @@ Variable_name Value character_set_client latin1 SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; charset('a') collation('a') coercibility('a') 'a'='A' -latin1 latin1_swedish_ci 4 1 +latin1 latin1_swedish_ci 5 1 explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used @@ -525,7 +525,7 @@ SHOW VARIABLES LIKE 'collation_client'; Variable_name Value SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; charset('a') collation('a') coercibility('a') 'a'='A' -latin1 latin1_swedish_ci 4 1 +latin1 latin1_swedish_ci 5 1 SET CHARACTER SET 'DEFAULT'; ERROR 42000: Unknown character set: 'DEFAULT' DROP TABLE t1; @@ -683,7 +683,7 @@ RETURN "Testtext"; END;// SELECT getText(), CHARSET(getText()), COLLATION(getText()), COERCIBILITY(getText()); getText() CHARSET(getText()) COLLATION(getText()) COERCIBILITY(getText()) -Testtext latin1 latin1_swedish_ci 4 +Testtext latin1 latin1_swedish_ci 5 CREATE TABLE t1 AS SELECT ' - ' AS a UNION SELECT getText(); ERROR HY000: Illegal mix of collations for operation 'UNION' DROP FUNCTION getText; @@ -696,7 +696,7 @@ RETURN "Testtext"; END;// SELECT getText(), CHARSET(getText()), COLLATION(getText()), COERCIBILITY(getText()); getText() CHARSET(getText()) COLLATION(getText()) COERCIBILITY(getText()) -Testtext latin1 latin1_german2_ci 4 +Testtext latin1 latin1_german2_ci 5 CREATE TABLE t1 AS SELECT ' - ' AS a UNION SELECT getText(); SHOW CREATE TABLE t1; Table Create Table @@ -714,7 +714,7 @@ RETURN "Testtext"; END;// SELECT getText(), CHARSET(getText()), COLLATION(getText()), COERCIBILITY(getText()); getText() CHARSET(getText()) COLLATION(getText()) COERCIBILITY(getText()) -Testtext latin1 latin1_german2_ci 4 +Testtext latin1 latin1_german2_ci 5 CREATE TABLE t1 AS SELECT ' - ' AS a UNION SELECT getText(); SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/main/ctype_cp1251.result b/mysql-test/main/ctype_cp1251.result index 3702c9d860f..fa98a14cff6 100644 --- a/mysql-test/main/ctype_cp1251.result +++ b/mysql-test/main/ctype_cp1251.result @@ -835,7 +835,7 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) -34 +35 create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table @@ -1223,7 +1223,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)) -5 2 +6 4 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 4c08f8f488b..e8840b2f440 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -1144,7 +1144,7 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) -34 +35 create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table @@ -1532,7 +1532,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)) -5 2 +6 4 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_latin2.result b/mysql-test/main/ctype_latin2.result index 9ab54f317c3..b786e11503a 100644 --- a/mysql-test/main/ctype_latin2.result +++ b/mysql-test/main/ctype_latin2.result @@ -585,31 +585,31 @@ CHARSET('2013-11-15 00:41:28' - INTERVAL 7 DAY) latin2 SELECT COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY) -4 +5 SELECT CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) binary SELECT COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) -5 +6 SELECT CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) latin2 SELECT COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) latin2 SELECT COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) latin2 SELECT COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) 323030312D30312D30312030303A30303A3030 @@ -618,7 +618,7 @@ CHARSET(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) latin2 SELECT COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) 323030312D30312D30312030303A30303A3030 diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index 3df7d90bd36..8be4ca24dda 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -2024,7 +2024,7 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) -0034 +0035 create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table @@ -2412,7 +2412,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)) -5 2 +6 4 select charset(concat(uuid(), cast('a' as char character set latin1))); charset(concat(uuid(), cast('a' as char character set latin1))) latin1 @@ -5191,31 +5191,31 @@ CHARSET('2013-11-15 00:41:28' - INTERVAL 7 DAY) ucs2 SELECT COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY) -4 +5 SELECT CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) binary SELECT COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) -5 +6 SELECT CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) ucs2 SELECT COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) ucs2 SELECT COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) ucs2 SELECT COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) 0032003000300031002D00300031002D00300031002000300030003A00300030003A00300030 @@ -5224,7 +5224,7 @@ CHARSET(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) ucs2 SELECT COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) 0032003000300031002D00300031002D00300031002000300030003A00300030003A00300030 diff --git a/mysql-test/main/ctype_utf16.result b/mysql-test/main/ctype_utf16.result index 834d05828ca..21b55e558d9 100644 --- a/mysql-test/main/ctype_utf16.result +++ b/mysql-test/main/ctype_utf16.result @@ -1392,31 +1392,31 @@ CHARSET('2013-11-15 00:41:28' - INTERVAL 7 DAY) utf16 SELECT COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY) -4 +5 SELECT CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) binary SELECT COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) -5 +6 SELECT CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) utf16 SELECT COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) utf16 SELECT COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) utf16 SELECT COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) 0032003000300031002D00300031002D00300031002000300030003A00300030003A00300030 @@ -1425,7 +1425,7 @@ CHARSET(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) utf16 SELECT COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) 0032003000300031002D00300031002D00300031002000300030003A00300030003A00300030 diff --git a/mysql-test/main/ctype_utf16le.result b/mysql-test/main/ctype_utf16le.result index 99e9a2ef4d3..e5b07ef1767 100644 --- a/mysql-test/main/ctype_utf16le.result +++ b/mysql-test/main/ctype_utf16le.result @@ -1663,31 +1663,31 @@ CHARSET('2013-11-15 00:41:28' - INTERVAL 7 DAY) utf16le SELECT COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY) -4 +5 SELECT CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) binary SELECT COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) -5 +6 SELECT CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) utf16le SELECT COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) utf16le SELECT COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) utf16le SELECT COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) 32003000300031002D00300031002D00300031002000300030003A00300030003A0030003000 @@ -1696,7 +1696,7 @@ CHARSET(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) utf16le SELECT COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) 32003000300031002D00300031002D00300031002000300030003A00300030003A0030003000 diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index 47497cdd771..ef8feeab49a 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -1339,31 +1339,31 @@ CHARSET('2013-11-15 00:41:28' - INTERVAL 7 DAY) utf32 SELECT COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY) -4 +5 SELECT CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) binary SELECT COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) -5 +6 SELECT CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) utf32 SELECT COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) utf32 SELECT COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) -4 +5 SELECT CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) utf32 SELECT COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) 000000320000003000000030000000310000002D00000030000000310000002D00000030000000310000002000000030000000300000003A00000030000000300000003A0000003000000030 @@ -1372,7 +1372,7 @@ CHARSET(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) utf32 SELECT COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) -4 +5 SELECT HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) 000000320000003000000030000000310000002D00000030000000310000002D00000030000000310000002000000030000000300000003A00000030000000300000003A0000003000000030 diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index b02e07e96e2..c8755c47f89 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -2016,7 +2016,7 @@ insert into t1 values('t1_val'); create view v1 as select 'v1_val' as col1; select coercibility(col1), collation(col1) from v1; coercibility(col1) collation(col1) -4 utf8mb3_general_ci +5 utf8mb3_general_ci create view v2 as select col1 from v1 union select col1 from t1; select coercibility(col1), collation(col1)from v2; coercibility(col1) collation(col1) @@ -2896,7 +2896,7 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) -34 +35 create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table @@ -3284,7 +3284,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)) -5 2 +6 4 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_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result index 00d22c32b94..3c91316b18e 100644 --- a/mysql-test/main/ctype_utf8mb4.result +++ b/mysql-test/main/ctype_utf8mb4.result @@ -2042,7 +2042,7 @@ insert into t1 values('t1_val'); create view v1 as select 'v1_val' as col1; select coercibility(col1), collation(col1) from v1; coercibility(col1) collation(col1) -4 utf8mb4_general_ci +5 utf8mb4_general_ci create view v2 as select col1 from v1 union select col1 from t1; select coercibility(col1), collation(col1)from v2; coercibility(col1) collation(col1) diff --git a/mysql-test/main/ctype_utf8mb4_heap.result b/mysql-test/main/ctype_utf8mb4_heap.result index 4b23040db9c..91647451458 100644 --- a/mysql-test/main/ctype_utf8mb4_heap.result +++ b/mysql-test/main/ctype_utf8mb4_heap.result @@ -1874,7 +1874,7 @@ insert into t1 values('t1_val'); create view v1 as select 'v1_val' as col1; select coercibility(col1), collation(col1) from v1; coercibility(col1) collation(col1) -4 utf8mb4_general_ci +5 utf8mb4_general_ci create view v2 as select col1 from v1 union select col1 from t1; select coercibility(col1), collation(col1)from v2; coercibility(col1) collation(col1) diff --git a/mysql-test/main/ctype_utf8mb4_innodb.result b/mysql-test/main/ctype_utf8mb4_innodb.result index 0291823ded3..f52b87f2cd8 100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.result +++ b/mysql-test/main/ctype_utf8mb4_innodb.result @@ -2000,7 +2000,7 @@ insert into t1 values('t1_val'); create view v1 as select 'v1_val' as col1; select coercibility(col1), collation(col1) from v1; coercibility(col1) collation(col1) -4 utf8mb4_general_ci +5 utf8mb4_general_ci create view v2 as select col1 from v1 union select col1 from t1; select coercibility(col1), collation(col1)from v2; coercibility(col1) collation(col1) diff --git a/mysql-test/main/ctype_utf8mb4_myisam.result b/mysql-test/main/ctype_utf8mb4_myisam.result index 0ccde4ccac9..404fc5710de 100644 --- a/mysql-test/main/ctype_utf8mb4_myisam.result +++ b/mysql-test/main/ctype_utf8mb4_myisam.result @@ -2007,7 +2007,7 @@ insert into t1 values('t1_val'); create view v1 as select 'v1_val' as col1; select coercibility(col1), collation(col1) from v1; coercibility(col1) collation(col1) -4 utf8mb4_general_ci +5 utf8mb4_general_ci create view v2 as select col1 from v1 union select col1 from t1; select coercibility(col1), collation(col1)from v2; coercibility(col1) collation(col1) diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result index cf1d31e3bc7..854e04a9071 100644 --- a/mysql-test/main/default.result +++ b/mysql-test/main/default.result @@ -2969,7 +2969,7 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 (a) VALUES ('test'); SELECT * FROM t1; a b c -test 2 5 +test 2 6 DROP TABLE t1; # # String result metadata functions diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result index 37102e7dd88..434745c66e3 100644 --- a/mysql-test/main/func_misc.result +++ b/mysql-test/main/func_misc.result @@ -1477,10 +1477,10 @@ COERCIBILITY(NAME_CONST('name','test')) 2 SELECT COERCIBILITY(NAME_CONST('name',TIME'00:00:00')); COERCIBILITY(NAME_CONST('name',TIME'00:00:00')) -5 +6 SELECT COERCIBILITY(NAME_CONST('name',15)); COERCIBILITY(NAME_CONST('name',15)) -5 +6 SELECT CONCAT(NAME_CONST('name',15),'오'); CONCAT(NAME_CONST('name',15),'오') 15오 diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index 59595dffa99..5abfadabd52 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -608,103 +608,103 @@ select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE la ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_swedish_ci,COERCIBLE), (latin1_bin,EXPLICIT) for operation 'in' select collation(bin(130)), coercibility(bin(130)); collation(bin(130)) coercibility(bin(130)) -latin1_swedish_ci 4 +latin1_swedish_ci 5 select collation(oct(130)), coercibility(oct(130)); collation(oct(130)) coercibility(oct(130)) -latin1_swedish_ci 4 +latin1_swedish_ci 5 select collation(conv(130,16,10)), coercibility(conv(130,16,10)); collation(conv(130,16,10)) coercibility(conv(130,16,10)) -latin1_swedish_ci 4 +latin1_swedish_ci 5 select collation(hex(130)), coercibility(hex(130)); collation(hex(130)) coercibility(hex(130)) -latin1_swedish_ci 4 +latin1_swedish_ci 5 select collation(char(130)), coercibility(hex(130)); collation(char(130)) coercibility(hex(130)) -binary 4 +binary 5 select collation(format(130,10)), coercibility(format(130,10)); collation(format(130,10)) coercibility(format(130,10)) -latin1_swedish_ci 4 +latin1_swedish_ci 5 select collation(lcase(_latin2'a')), coercibility(lcase(_latin2'a')); collation(lcase(_latin2'a')) coercibility(lcase(_latin2'a')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(ucase(_latin2'a')), coercibility(ucase(_latin2'a')); collation(ucase(_latin2'a')) coercibility(ucase(_latin2'a')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(left(_latin2'a',1)), coercibility(left(_latin2'a',1)); collation(left(_latin2'a',1)) coercibility(left(_latin2'a',1)) -latin2_general_ci 4 +latin2_general_ci 5 select collation(right(_latin2'a',1)), coercibility(right(_latin2'a',1)); collation(right(_latin2'a',1)) coercibility(right(_latin2'a',1)) -latin2_general_ci 4 +latin2_general_ci 5 select collation(substring(_latin2'a',1,1)), coercibility(substring(_latin2'a',1,1)); collation(substring(_latin2'a',1,1)) coercibility(substring(_latin2'a',1,1)) -latin2_general_ci 4 +latin2_general_ci 5 select collation(concat(_latin2'a',_latin2'b')), coercibility(concat(_latin2'a',_latin2'b')); collation(concat(_latin2'a',_latin2'b')) coercibility(concat(_latin2'a',_latin2'b')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(lpad(_latin2'a',4,_latin2'b')), coercibility(lpad(_latin2'a',4,_latin2'b')); collation(lpad(_latin2'a',4,_latin2'b')) coercibility(lpad(_latin2'a',4,_latin2'b')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(lpad(_latin2'a',4)), coercibility(lpad(_latin2'a',4)); collation(lpad(_latin2'a',4)) coercibility(lpad(_latin2'a',4)) -latin2_general_ci 4 +latin2_general_ci 5 select collation(rpad(_latin2'a',4,_latin2'b')), coercibility(rpad(_latin2'a',4,_latin2'b')); collation(rpad(_latin2'a',4,_latin2'b')) coercibility(rpad(_latin2'a',4,_latin2'b')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(rpad(_latin2'a',4)), coercibility(rpad(_latin2'a',4)); collation(rpad(_latin2'a',4)) coercibility(rpad(_latin2'a',4)) -latin2_general_ci 4 +latin2_general_ci 5 select collation(concat_ws(_latin2'a',_latin2'b')), coercibility(concat_ws(_latin2'a',_latin2'b')); collation(concat_ws(_latin2'a',_latin2'b')) coercibility(concat_ws(_latin2'a',_latin2'b')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(make_set(255,_latin2'a',_latin2'b',_latin2'c')), coercibility(make_set(255,_latin2'a',_latin2'b',_latin2'c')); collation(make_set(255,_latin2'a',_latin2'b',_latin2'c')) coercibility(make_set(255,_latin2'a',_latin2'b',_latin2'c')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(export_set(255,_latin2'y',_latin2'n',_latin2' ')), coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' ')); collation(export_set(255,_latin2'y',_latin2'n',_latin2' ')) coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' ')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(trim(_latin2' a ')), coercibility(trim(_latin2' a ')); collation(trim(_latin2' a ')) coercibility(trim(_latin2' a ')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(ltrim(_latin2' a ')), coercibility(ltrim(_latin2' a ')); collation(ltrim(_latin2' a ')) coercibility(ltrim(_latin2' a ')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(rtrim(_latin2' a ')), coercibility(rtrim(_latin2' a ')); collation(rtrim(_latin2' a ')) coercibility(rtrim(_latin2' a ')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(trim(LEADING _latin2' ' FROM _latin2'a')), coercibility(trim(LEADING _latin2'a' FROM _latin2'a')); collation(trim(LEADING _latin2' ' FROM _latin2'a')) coercibility(trim(LEADING _latin2'a' FROM _latin2'a')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(trim(TRAILING _latin2' ' FROM _latin2'a')), coercibility(trim(TRAILING _latin2'a' FROM _latin2'a')); collation(trim(TRAILING _latin2' ' FROM _latin2'a')) coercibility(trim(TRAILING _latin2'a' FROM _latin2'a')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(trim(BOTH _latin2' ' FROM _latin2'a')), coercibility(trim(BOTH _latin2'a' FROM _latin2'a')); collation(trim(BOTH _latin2' ' FROM _latin2'a')) coercibility(trim(BOTH _latin2'a' FROM _latin2'a')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(repeat(_latin2'a',10)), coercibility(repeat(_latin2'a',10)); collation(repeat(_latin2'a',10)) coercibility(repeat(_latin2'a',10)) -latin2_general_ci 4 +latin2_general_ci 5 select collation(reverse(_latin2'ab')), coercibility(reverse(_latin2'ab')); collation(reverse(_latin2'ab')) coercibility(reverse(_latin2'ab')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(quote(_latin2'ab')), coercibility(quote(_latin2'ab')); collation(quote(_latin2'ab')) coercibility(quote(_latin2'ab')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab')); collation(soundex(_latin2'ab')) coercibility(soundex(_latin2'ab')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1)); collation(substring(_latin2'ab',1)) coercibility(substring(_latin2'ab',1)) -latin2_general_ci 4 +latin2_general_ci 5 select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef')); collation(insert(_latin2'abcd',2,3,_latin2'ef')) coercibility(insert(_latin2'abcd',2,3,_latin2'ef')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B')); collation(replace(_latin2'abcd',_latin2'b',_latin2'B')) coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B')) -latin2_general_ci 4 +latin2_general_ci 5 select collation(encode('abcd','ab')), coercibility(encode('abcd','ab')); collation(encode('abcd','ab')) coercibility(encode('abcd','ab')) -binary 4 +binary 5 create table t1 select bin(130), @@ -787,7 +787,7 @@ latin2 latin2_general_ci 2 drop table t1; select charset(null), collation(null), coercibility(null); charset(null) collation(null) coercibility(null) -binary binary 6 +binary binary 7 CREATE TABLE t1 (a int, b int); CREATE TABLE t2 (a int, b int); INSERT INTO t1 VALUES (1,1),(2,2); @@ -803,7 +803,7 @@ a b a b 1 1 NULL NULL 2 2 2 2 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b) -where coercibility(t2.a) = 5 order by t1.a,t2.a; +where coercibility(t2.a) = 6 order by t1.a,t2.a; a b a b 1 1 NULL NULL 2 2 2 2 @@ -5663,3 +5663,32 @@ CONV(-9223372036854775808, -10, -62) # # End of 11.4 tests # +# +# Start of 11.5 tests +# +# +# MDEV-25829 Change default collation to utf8mb4_1400_ai_ci +# +SELECT +coercibility(CAST(1 AS CHAR)), +coercibility(CONVERT('a' USING latin1)); +coercibility(CAST(1 AS CHAR)) 4 +coercibility(CONVERT('a' USING latin1)) 4 +SELECT +coercibility(CAST(1 AS BINARY)), +coercibility(CONVERT('a' USING binary)), +coercibility(binary'a'); +coercibility(CAST(1 AS BINARY)) 2 +coercibility(CONVERT('a' USING binary)) 2 +coercibility(binary'a') 2 +EXPLAIN EXTENDED SELECT +CAST(1 AS BINARY) AS c, +CONVERT('a' USING binary), +BINARY'a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select cast(1 as char charset binary) AS `c`,convert('a' using binary) AS `CONVERT('a' USING binary)`,cast('a' as char charset binary) AS `BINARY'a'` +# +# End of 11.5 tests +# diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 163b65d5578..b400d2639ea 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -485,7 +485,7 @@ where collation(t2.a) = _utf8'binary' order by t1.a,t2.a; select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b) where charset(t2.a) = _utf8'binary' order by t1.a,t2.a; select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b) -where coercibility(t2.a) = 5 order by t1.a,t2.a; +where coercibility(t2.a) = 6 order by t1.a,t2.a; DROP TABLE t1, t2; # @@ -2571,3 +2571,32 @@ SELECT CONV(-9223372036854775808, -10, -62); --echo # --echo # End of 11.4 tests --echo # + + +--echo # +--echo # Start of 11.5 tests +--echo # + +--echo # +--echo # MDEV-25829 Change default collation to utf8mb4_1400_ai_ci +--echo # + +--vertical_results +SELECT + coercibility(CAST(1 AS CHAR)), + coercibility(CONVERT('a' USING latin1)); + +SELECT + coercibility(CAST(1 AS BINARY)), + coercibility(CONVERT('a' USING binary)), + coercibility(binary'a'); +--horizontal_results + +EXPLAIN EXTENDED SELECT + CAST(1 AS BINARY) AS c, + CONVERT('a' USING binary), + BINARY'a'; + +--echo # +--echo # End of 11.5 tests +--echo # diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index c3acc114786..2fb60e330ba 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -638,7 +638,7 @@ LOWER(MONTHNAME(19700101)) january SELECT COERCIBILITY(MONTHNAME('1970-01-01')),COERCIBILITY(DAYNAME('1970-01-01')); COERCIBILITY(MONTHNAME('1970-01-01')) COERCIBILITY(DAYNAME('1970-01-01')) -4 4 +5 5 CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time); INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08"); SELECT * from t1; diff --git a/mysql-test/main/func_weight_string.result b/mysql-test/main/func_weight_string.result index b2649ed3321..9a949d2d209 100644 --- a/mysql-test/main/func_weight_string.result +++ b/mysql-test/main/func_weight_string.result @@ -69,7 +69,7 @@ weight_string reverse 1 2 select coercibility(weight_string('test')); coercibility(weight_string('test')) -4 +5 select coercibility(weight_string('test' collate latin1_swedish_ci)); coercibility(weight_string('test' collate latin1_swedish_ci)) 0 diff --git a/mysql-test/main/get_diagnostics.result b/mysql-test/main/get_diagnostics.result index b6ba0bb3263..2425be161c4 100644 --- a/mysql-test/main/get_diagnostics.result +++ b/mysql-test/main/get_diagnostics.result @@ -774,10 +774,10 @@ Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value GET DIAGNOSTICS CONDITION 1 @var1 = MESSAGE_TEXT, @var2 = CLASS_ORIGIN; SELECT CHARSET(@var1), COLLATION(@var1), COERCIBILITY(@var1); CHARSET(@var1) COLLATION(@var1) COERCIBILITY(@var1) -utf8mb3 utf8mb3_general_ci 4 +utf8mb3 utf8mb3_general_ci 5 SELECT CHARSET(@var2), COLLATION(@var2), COERCIBILITY(@var2); CHARSET(@var2) COLLATION(@var2) COERCIBILITY(@var2) -utf8mb3 utf8mb3_general_ci 4 +utf8mb3 utf8mb3_general_ci 5 # # Command statistics # diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 8cf4a000427..148b3f626e5 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -4885,7 +4885,7 @@ UNCOMPRESSED_LENGTH(POINT(1,1)) 0 SELECT COERCIBILITY(POINT(1,1)); COERCIBILITY(POINT(1,1)) -4 +5 SELECT ASCII(POINT(1,1)); ASCII(POINT(1,1)) 0 diff --git a/mysql-test/main/metadata.result b/mysql-test/main/metadata.result index 3bd9dde4a6c..97b46b6716f 100644 --- a/mysql-test/main/metadata.result +++ b/mysql-test/main/metadata.result @@ -426,7 +426,7 @@ def ORD('a') 3 7 2 N 32897 0 63 def CRC32('a') 3 10 10 N 32929 0 63 def UNCOMPRESSED_LENGTH(COMPRESS('a')) 3 10 1 Y 32896 0 63 STRCMP('a','b') OCTET_LENGTH('a') CHAR_LENGTH('a') COERCIBILITY('a') ASCII('a') ORD('a') CRC32('a') UNCOMPRESSED_LENGTH(COMPRESS('a')) --1 1 1 4 97 97 3904355907 1 +-1 1 1 5 97 97 3904355907 1 SELECT INTERVAL(2,1,2,3), REGEXP_INSTR('a','a'), diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index 2e5b5dbbf15..13930d55049 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -5175,19 +5175,19 @@ CHARSET(CONCAT(?,_latin1'a')) latin1 EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5; COERCIBILITY(?) -5 +6 EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5; COERCIBILITY(?) -5 +6 EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0; COERCIBILITY(?) -5 +6 EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30'; COERCIBILITY(?) -5 +6 EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; COERCIBILITY(?) -5 +6 # # MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL # diff --git a/mysql-test/main/type_blob.result b/mysql-test/main/type_blob.result index bc25af5af90..79dae449b6b 100644 --- a/mysql-test/main/type_blob.result +++ b/mysql-test/main/type_blob.result @@ -520,7 +520,7 @@ charset(load_file('../../std_data/words.dat')), collation(load_file('../../std_data/words.dat')), coercibility(load_file('../../std_data/words.dat')); charset(load_file('../../std_data/words.dat')) collation(load_file('../../std_data/words.dat')) coercibility(load_file('../../std_data/words.dat')) -binary binary 4 +binary binary 5 explain extended select charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')), collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')), diff --git a/mysql-test/main/user_var.result b/mysql-test/main/user_var.result index 4bdf3a18cf2..f0a7ea73f0e 100644 --- a/mysql-test/main/user_var.result +++ b/mysql-test/main/user_var.result @@ -137,7 +137,7 @@ drop table t1; set @a=_latin2'test'; select charset(@a),collation(@a),coercibility(@a); charset(@a) collation(@a) coercibility(@a) -latin2 latin2_general_ci 4 +latin2 latin2_general_ci 5 select @a=_latin2'TEST'; @a=_latin2'TEST' 1 @@ -147,7 +147,7 @@ select @a=_latin2'TEST' collate latin2_bin; set @a=_latin2'test' collate latin2_general_ci; select charset(@a),collation(@a),coercibility(@a); charset(@a) collation(@a) coercibility(@a) -latin2 latin2_general_ci 4 +latin2 latin2_general_ci 5 select @a=_latin2'TEST'; @a=_latin2'TEST' 1 @@ -162,19 +162,19 @@ collation(@a:=_latin2'test') latin2_general_ci select coercibility(@a:=_latin2'test'); coercibility(@a:=_latin2'test') -4 +5 select collation(@a:=_latin2'test' collate latin2_bin); collation(@a:=_latin2'test' collate latin2_bin) latin2_bin select coercibility(@a:=_latin2'test' collate latin2_bin); coercibility(@a:=_latin2'test' collate latin2_bin) -4 +5 select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'; (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' 0 select charset(@a),collation(@a),coercibility(@a); charset(@a) collation(@a) coercibility(@a) -latin2 latin2_bin 4 +latin2 latin2_bin 5 select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci; (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci 1 @@ -184,11 +184,11 @@ my_column 0 select @v, coercibility(@v); @v coercibility(@v) -NULL 4 +NULL 5 set @v1=null, @v2=1, @v3=1.1, @v4=now(); select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4); coercibility(@v1) coercibility(@v2) coercibility(@v3) coercibility(@v4) -4 5 5 4 +5 6 6 5 set session @honk=99; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@honk=99' at line 1 select @@local.max_allowed_packet; diff --git a/sql/item.cc b/sql/item.cc index db8c858ba14..23929ed94ef 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2390,10 +2390,7 @@ left_is_superset(const DTCollation *left, const DTCollation *right) Aggregate two collations together taking into account their coercibility (aka derivation):. - 0 == DERIVATION_EXPLICIT - an explicitly written COLLATE clause @n - 1 == DERIVATION_NONE - a mix of two different collations @n - 2 == DERIVATION_IMPLICIT - a column @n - 3 == DERIVATION_COERCIBLE - a string constant. + See the definition of enum Derivation for details. The most important rules are: -# If collations are the same: diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index cca58f93b25..9ef1aa709a3 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4017,7 +4017,9 @@ String *Item_func_conv_charset::val_str(String *str) bool Item_func_conv_charset::fix_length_and_dec(THD *thd) { - DBUG_ASSERT(collation.derivation == DERIVATION_IMPLICIT); + DBUG_ASSERT(collation.derivation == DERIVATION_CAST || + (collation.derivation == DERIVATION_IMPLICIT && + collation.collation == &my_charset_bin)); fix_char_length(args[0]->max_char_length()); return FALSE; } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 7b8cb3b6391..490e6b7c2ad 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1893,13 +1893,13 @@ public: Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs): Item_str_func(thd, a) { - collation.set(cs, DERIVATION_IMPLICIT); + collation= DTCollation::string_typecast(cs); use_cached_value= 0; safe= 0; } Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs, bool cache_if_const): Item_str_func(thd, a) { - collation.set(cs, DERIVATION_IMPLICIT); + collation= DTCollation::string_typecast(cs); if (cache_if_const && args[0]->can_eval_in_optimize()) { uint errors= 0; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 2cf63c2d284..a6aebf33489 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -3376,7 +3376,7 @@ void Item_char_typecast::fix_length_and_dec_internal(CHARSET_INFO *from_cs) (!my_charset_same(from_cs, cast_cs) && from_cs != &my_charset_bin && cast_cs != &my_charset_bin); - collation.set(cast_cs, DERIVATION_IMPLICIT); + collation= DTCollation::string_typecast(cast_cs); char_length= ((cast_length != ~0U) ? cast_length : args[0]->max_length / (cast_cs == &my_charset_bin ? 1 : diff --git a/sql/sql_type.h b/sql/sql_type.h index ecf996a7752..d41a5904f71 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -3019,13 +3019,46 @@ static inline my_repertoire_t &operator|=(my_repertoire_t &a, enum Derivation { - DERIVATION_IGNORABLE= 6, - DERIVATION_NUMERIC= 5, - DERIVATION_COERCIBLE= 4, + DERIVATION_IGNORABLE= 7, // Explicit NULL + + /* + Explicit or implicit conversion from numeric/temporal data to string: + - Numbers/temporals in string context + - Numeric user variables + - CAST(numeric_or_temporal_expr AS CHAR) + */ + DERIVATION_NUMERIC= 6, + + /* + - String literals + - String user variables + */ + DERIVATION_COERCIBLE= 5, + + /* + String cast and conversion functions: + - BINARY(expr) + - CAST(string_expr AS CHAR) + - CONVERT(expr USING cs) + */ + DERIVATION_CAST= 4, + + /* + utf8 metadata functions: + - DATABASE() + - CURRENT_ROLE() + - USER() + */ DERIVATION_SYSCONST= 3, + + /* + - Table columns + - SP variables + - BINARY(expr) and CAST(expr AS BINARY) + */ DERIVATION_IMPLICIT= 2, - DERIVATION_NONE= 1, - DERIVATION_EXPLICIT= 0 + DERIVATION_NONE= 1, // A mix (e.g. CONCAT) of two differrent collations + DERIVATION_EXPLICIT= 0 // An explicit COLLATE clause }; @@ -3079,6 +3112,12 @@ public: derivation(derivation_arg), repertoire(repertoire_arg) { } + static DTCollation string_typecast(CHARSET_INFO *collation_arg) + { + return DTCollation(collation_arg, + collation_arg == &my_charset_bin ? + DERIVATION_IMPLICIT : DERIVATION_CAST); + } void set(const DTCollation &dt) { *this= dt; @@ -3114,6 +3153,7 @@ public: case DERIVATION_NUMERIC: return "NUMERIC"; case DERIVATION_IGNORABLE: return "IGNORABLE"; case DERIVATION_COERCIBLE: return "COERCIBLE"; + case DERIVATION_CAST: return "CAST"; case DERIVATION_IMPLICIT: return "IMPLICIT"; case DERIVATION_SYSCONST: return "SYSCONST"; case DERIVATION_EXPLICIT: return "EXPLICIT";