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

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

    XMLWordPrintable

Details

    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)

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.