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

Wrong utf8mb4_0900_bin alias for utf8mb4_bin (should be utf8mb4_nopad_bin)

Details

    Description

      I run this query:

      SELECT collation_name, id, comment
      FROM information_schema.collations
      WHERE collation_name='utf8mb4_0900_bin';
      

      It says utf8mb4_0900_bin is an alias for utf8mb4_bin:

      +------------------+------+-----------------------+
      | collation_name   | id   | comment               |
      +------------------+------+-----------------------+
      | utf8mb4_0900_bin |  309 | Alias for utf8mb4_bin |
      +------------------+------+-----------------------+
      

      This looks wrong.

      According to https://dev.mysql.com/doc/refman/8.4/en/charset-mysql.html, utf8mb4_0900_bin is a NO PAD collation:

      | utf8mb4_0900_bin           | utf8mb4 | 309 |         | Yes      |       1 | NO PAD        |
      

      utf8mb4_0900_bin should be fixed to be an alias for utf8mb4_nopad_bin.

      MySQL

      MySQL [test]> SET NAMES utf8mb4 COLLATE utf8mb4_0900_bin;
      Query OK, 0 rows affected (0.000 sec)
       
      MySQL [test]> SELECT 'a\t'<'a';
      +-----------+
      | 'a\t'<'a' |
      +-----------+
      |         0 |
      +-----------+
      1 row in set (0.000 sec)
       
      MySQL [test]> SET NAMES utf8mb4 COLLATE utf8mb4_bin;
      Query OK, 0 rows affected (0.000 sec)
       
      MySQL [test]> SELECT 'a\t'<'a';
      +-----------+
      | 'a\t'<'a' |
      +-----------+
      |         1 |
      +-----------+
      1 row in set (0.000 sec)
      

      MariaDB

      MariaDB [test]> SET NAMES utf8mb4 COLLATE utf8mb4_0900_bin;
      Query OK, 0 rows affected (0.001 sec)
       
      MariaDB [test]> SELECT 'a\t'<'a';
      +-----------+
      | 'a\t'<'a' |
      +-----------+
      |         1 |    <---  0 is expected here
      +-----------+
      1 row in set (0.001 sec)
       
      MariaDB [test]> SET NAMES utf8mb4 COLLATE utf8mb4_bin;
      Query OK, 0 rows affected (0.000 sec)
       
      MariaDB [test]> SELECT 'a\t'<'a';
      +-----------+
      | 'a\t'<'a' |
      +-----------+
      |         1 |
      +-----------+
      1 row in set (0.001 sec)
      

      Attachments

        Issue Links

          Activity

            Transition Time In Source Status Execution Times
            Alexander Barkov made transition -
            Open Closed
            3h 25m 1

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.