Bug #41859 | Two element row constructor causes Illegal mix of collations | ||
---|---|---|---|
Submitted: | 5 Jan 2009 10:47 | Modified: | 23 Jan 2009 15:13 |
Reporter: | Janek Bogucki | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Charsets | Severity: | S3 (Non-critical) |
Version: | 5.0.51a-3ubuntu5.4-log, 5.0.74 | OS: | Linux (Ubuntu 8.04.2) |
Assigned to: | CPU Architecture: | Any |
[5 Jan 2009 10:47]
Janek Bogucki
[5 Jan 2009 13:10]
Valeriy Kravchuk
Verified with 5.0.74: C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -proot -P3308 test Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 25 Server version: 5.0.74-enterprise-gpl-nt-log MySQL Enterprise Server - Pro Editi on (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE TABLE `Country` ( -> `Code` char(3) NOT NULL default '', -> `Name` char(52) NOT NULL default '', -> `Continent` enum('Asia','Europe','North America','Africa','Oceania','An tarctica','South '> America') NOT NULL default 'Asia', -> `Region` char(26) NOT NULL default '', -> `SurfaceArea` float(10,2) NOT NULL default '0.00', -> `IndepYear` smallint(6) default NULL, -> `Population` int(11) NOT NULL default '0', -> `LifeExpectancy` float(3,1) default NULL, -> `GNP` float(10,2) default NULL, -> `GNPOld` float(10,2) default NULL, -> `LocalName` char(45) NOT NULL default '', -> `GovernmentForm` char(45) NOT NULL default '', -> `HeadOfState` char(60) default NULL, -> `Capital` int(11) default NULL, -> `Code2` char(2) NOT NULL default '', -> PRIMARY KEY (`Code`) -> ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Query OK, 0 rows affected (0.09 sec) mysql> select Name, Continent from Country where (Continent, Region) = ('Europe ', 'Western Europe'); ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and ( utf8_general_ci,COERCIBLE) for operation '=' mysql> select Name, Continent from Country where (Continent, Region) = (_latin1 'Europe', _latin1'Western Europe'); Empty set (0.00 sec) The other workaroud is just to set latin1 as "default": mysql> set names latin1; Query OK, 0 rows affected (0.00 sec) mysql> select Name, Continent from Country where (Continent, Region) = ('Europe ', 'Western Europe'); Empty set (0.00 sec) But still I think this is a bug, as individual columns can be compared without any problems: mysql> set names utf8; Query OK, 0 rows affected (0.00 sec) mysql> select Name, Continent from Country where (Continent, Region) = ('Europe ', 'Western Europe'); ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and ( utf8_general_ci,COERCIBLE) for operation '=' mysql> select Name, Continent from Country where Continent = 'Europe'; Empty set (0.00 sec)
[23 Jan 2009 15:13]
Alexander Barkov
Duplicate to "Bug#37601 Cast Is Not Done On Row Comparison"