Bug #79260 | Get "ERROR 1271: Illegal mix of collations" when comparing time and string | ||
---|---|---|---|
Submitted: | 13 Nov 2015 7:33 | Modified: | 28 Nov 2019 21:41 |
Reporter: | Su Dylan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 5.7.8/5.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[13 Nov 2015 7:33]
Su Dylan
[14 Nov 2015 4:11]
MySQL Verification Team
Thank you for the bug report. I couldn't repeat with source server: C:\dbs>c:\dbs\5.7\bin\mysql -uroot -p --port=3570 --prompt="mysql 5.7 > " Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.10 Source distribution PULL: 2015-NOV-07 Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.7 > USE test Database changed mysql 5.7 > drop table t2; create table t2(a time(3), b varchar(100)); Query OK, 0 rows affected (0.02 sec) Query OK, 0 rows affected (0.03 sec) mysql 5.7 > select a = b from t2; Empty set (0.00 sec) C:\dbs>c:\dbs\5.6\bin\mysql -uroot --port=3560 -p --prompt="mysql 5.6 > " Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.6.28 Source distribution PULL: 2015-NOV-07 Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.6 > USE test Database changed mysql 5.6 > drop table t2; create table t2(a time(3), b varchar(100)); Query OK, 0 rows affected (0.05 sec) Query OK, 0 rows affected (0.03 sec) mysql 5.6 > select a = b from t2; Empty set (0.00 sec) Anyway see bug https://bugs.mysql.com/bug.php?id=73552;
[16 Nov 2015 3:48]
Su Dylan
Hi Miguel, Thanks for the reply. It turns out that it is related to charset 'utf8mb4'. Please use the following SQL statements to recreate. Recreate: ========= drop table t2; create table t2(a time(3), b varchar(100)) charset='utf8mb4'; select a = b from t2; Output: ======= mysql> drop table t2; create table t2(a time(3), b varchar(100)) charset='utf8mb4'; t a = b from t2; Query OK, 0 rows affected (0.01 sec) Query OK, 0 rows affected (0.01 sec) mysql> select a = b from t2; ERROR 1271 (HY000): Illegal mix of collations for operation '=' mysql> select version(); +-----------+ | version() | +-----------+ | 5.7.8-rc | +-----------+ 1 row in set (0.00 sec)
[16 Nov 2015 9:23]
MySQL Verification Team
Thank you for the feedback. C:\dbs>c:\dbs\5.7\bin\mysql -uroot -p --port=3570 --prompt="mysql 5.7 > " Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.7.10 Source distribution PULL: 2015-NOV-07 Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.7 > use test Database changed mysql 5.7 > drop table t2; create table t2(a time(3), b varchar(100)) charset='utf8mb4'; Query OK, 0 rows affected (0.07 sec) Query OK, 0 rows affected (0.07 sec) mysql 5.7 > select a = b from t2; ERROR 1271 (HY000): Illegal mix of collations for operation '='
[16 Nov 2015 9:39]
MySQL Verification Team
5.6 affected too.
[28 Nov 2019 21:41]
Roy Lyseng
Posted by developer: Fixed in 5.7.29