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

Simple comparison causes "Illegal mix of collations" even with default server settings

    XMLWordPrintable

Details

    Description

      A default server installation on UTF-8 system has these character-set-related settings (taken from 11.5.2 Fedora 38 RPM):

      > show variables like 'character%';
      +--------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
      | Variable_name            | Value                                                                                                                                   |
      +--------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
      | character_set_client     | utf8mb3                                                                                                                                 |
      | character_set_collations | utf8mb3=utf8mb3_uca1400_ai_ci,ucs2=ucs2_uca1400_ai_ci,utf8mb4=utf8mb4_uca1400_ai_ci,utf16=utf16_uca1400_ai_ci,utf32=utf32_uca1400_ai_ci |
      | character_set_connection | utf8mb3                                                                                                                                 |
      | character_set_database   | latin1                                                                                                                                  |
      | character_set_filesystem | binary                                                                                                                                  |
      | character_set_results    | utf8mb3                                                                                                                                 |
      | character_set_server     | latin1                                                                                                                                  |
      | character_set_system     | utf8mb3                                                                                                                                 |
      | character_sets_dir       | /usr/share/mariadb/charsets/                                                                                                            |
      +--------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
      

      With this, even fairly basic operations appear to be impossible:

      MariaDB [(none)]> select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA = 'mysql' limit 1;
      Query OK, 1 row affected (0.003 sec)
       
      MariaDB [(none)]> select @col_type != 'binary(128)';
      ERROR 1267 (HY000): Illegal mix of collations (utf8mb3_general_ci,COERCIBLE) and (utf8mb3_uca1400_ai_ci,COERCIBLE) for operation '<>'
      

      The example above was taken from Spider initialization, which now produces the error upon startup.

      In MTR, we don't see it, because it changes clients' default-character-set to latin1.
      But by restoring utf8mb3 value, we get the same:

      --exec $MYSQL --default-character-set=utf8mb3 -e "select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA = 'mysql' limit 1; select @col_type != 'binary(128)'"
      

      --------------
      select @col_type != 'binary(128)'
      --------------
       
      ERROR 1267 (HY000) at line 1: Illegal mix of collations (utf8mb3_general_ci,COERCIBLE) and (utf8mb3_uca1400_ai_ci,COERCIBLE) for operation '<>'
      mysqltest: At line 1: exec of '/mnt8t/bld/11.5-asan/client//mariadb --defaults-file=/mnt8t/bld/11.5-asan/mysql-test/var/my.cnf --default-character-set=utf8mb3 -e "select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA = 'mysql' limit 1; select @col_type != 'binary(128)'; show variables like 'character%'"' failed, error: 256, status: 1, errno: 11
      

      I assume it is an effect of changing the default collation to UCA or surrounding changes, I didn't check which exact commit caused it.

      Attachments

        Issue Links

          Activity

            People

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