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

SQL Error [1253] - COLLATION 'utf8mb3_unicode_ci' is not valid for CHARACTER SET 'utf8mb4' introduced in MariaDB 10.11.11+

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Not a Bug
    • 10.11.16
    • N/A
    • Character Sets, JSON
    • None
    • MariaDB 10.11.16 (AWS RDS)
    • Not for Release Notes

    Description

      After upgrading AWS RDS MariaDB from 10.11.10 to 10.11.16, queries using `COLLATE utf8_unicode_ci` (utf8mb3_unicode_ci) in SQL expressions started throwing Error 1253. The same queries work fine on 10.11.10 and also on 11.5.2.

      *Steps to Reproduce:*
      1. Create a table with CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci
      2. Connect to server with default character_set_connection = utf8mb4
      3. Run a query with COLLATE utf8_unicode_ci in an expression:

      SELECT * FROM conditional_product_rule_configs
      WHERE id IN (869)
      AND JSON_UNQUOTE(JSON_EXTRACT(config, '$.key')) COLLATE utf8_unicode_ci = 'timeframe'
      LIMIT 1;
      

      *Expected Result:*
      Query executes successfully (as it did on 10.11.10 and 11.5.2)

      *Actual Result:*

      SQL Error [1253] [42000]: COLLATION 'utf8mb3_unicode_ci' is not valid for CHARACTER SET 'utf8mb4'
      

      *Environment:*

      • Affected version: MariaDB 10.11.16 (AWS RDS)
      • Working versions: MariaDB 10.11.10, MariaDB 11.5.2
      • Server variables:
      • character_set_connection = utf8mb4
      • collation_connection = utf8mb4_general_ci
      • character_set_server = utf8mb4
      • collation_server = utf8mb4_general_ci

      *Table DDL:*

      CREATE TABLE `conditional_product_rule_configs` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `config` text DEFAULT NULL,
        PRIMARY KEY (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
      

      *Workaround:*
      Set `init_connect = 'SET NAMES utf8mb3 COLLATE utf8mb3_unicode_ci'` in the Parameter Group, which forces the connection charset to match the query's collation.

      *Notes:*

      • The issue appears to be a regression introduced somewhere between 10.11.10 and 10.11.16
      • The behavior was fixed/reverted in 11.5.2
      • The root cause appears to be stricter collation validation against connection charset

      Attachments

        Activity

          People

            Unassigned Unassigned
            kien Kien
            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.