[MDEV-6688] Illegal mix of collation with bit string B'01100001' Created: 2014-09-03  Updated: 2014-09-04  Resolved: 2014-09-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.3.12, 5.5.39, 10.0.13
Fix Version/s: 10.0.14

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b INT);
INSERT INTO t1 VALUES ('a',1);
SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 X'61')) FROM t1;
SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 B'01100001')) FROM t1;

returns correct output for the first SELECT:

MariaDB [test]> SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 X'61')) FROM t1;
+-----------------------------------------------+
| CONCAT(a, IF(b>10, _utf8 X'61', _utf8 X'61')) |
+-----------------------------------------------+
| aa                                            |
+-----------------------------------------------+
1 row in set (0.00 sec

but returns an error for the second SELECT:

MariaDB [test]> SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 B'01100001')) FROM t1;
ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'

The second query should be fixed to return a result,
because _utf8 X'61' and _utf8 B'01100001' are actually
the same values representing Latin small letter 'a':

MariaDB [test]> SELECT _utf8 X'61', _utf8 B'01100001';
+-------------+-------------------+
| _utf8 X'61' | _utf8 B'01100001' |
+-------------+-------------------+
| a           | a                 |
+-------------+-------------------+
1 row in set (0.00 sec)


Generated at Thu Feb 08 07:13:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.