Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6688

Illegal mix of collation with bit string B'01100001'

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.12, 5.5.39, 10.0.13
    • Fix Version/s: 10.0.14
    • Component/s: None
    • 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)
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: