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

COLLATION(CAST('a' AS CHAR BINARY)) returns a wrong result

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5.40, 10.0.14
    • Fix Version/s: 10.1.3
    • Component/s: Character Sets, Parser
    • Labels:
      None

      Description

      mysql> SELECT COLLATION(CAST('a' AS CHAR BINARY));
      +-------------------------------------+
      | COLLATION(CAST('a' AS CHAR BINARY)) |
      +-------------------------------------+
      | utf8_general_ci                     |
      +-------------------------------------+
      1 row in set (0.00 se
      

      The expected result is utf8_bin.
      It would be inline with the same syntax in CREATE TABLE:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a CHAR BINARY) CHARSET=utf8;
      SHOW CREATE TABLE t1;
      
      +-------+-------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                            |
      +-------+-------------------------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `a` char(1) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
      +-------+-------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: