|
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4, b TEXT CHARACTER SET utf8mb3);
|
INSERT INTO t1 VALUES ('a','a');
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=b;
|
SHOW WARNINGS;
|
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------+
|
| Level | Code | Message |
|
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------+
|
| Note | 1003 | select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = convert(`test`.`t1`.`b` using utf8mb4) |
|
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------+
|
The Item_func_conv_charset behind CONVERT() is redundant here. utf8mb3 can be reinterpreted to utf8mb4 without conversion.
Note, we even allow online alter when converting an utf8mb3 column to utf8mb4 column with the same data type and size. The same optimization can be applied here.
|