Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
11.8.3
-
None
-
Ubuntu 24.04
-
Not for Release Notes
Description
Issue description
For backwards compatibility, default collation set is defined as collation-server = utf8mb3_general_ci in my.cnf file.
However, this value is being ignored as default one, and utf8mb3_uca1400_ai_ci is being set to all new databases and tables.
This causes issues, like "Illegal mix of collations (utf8mb3_general_ci,IMPLICIT) and (utf8mb3_uca1400_ai_ci,IMPLICIT) for operation '='" when attempt to apply migrations or do some altering on previously created tables.
The issue happens only when table has a default charset supplied, ie CREATE TABLE `x` (...) DEFAULT CHARSET=utf8mb3;.
In case CHARSET is not provided - it respects defined collation.
How to reproduce
- Add collation-server = utf8mb3_general_ci to my.cnf and restart server. Ensure collate is set:
MariaDB [(none)]> SHOW VARIABLES LIKE 'collation_server';+------------------+--------------------+| Variable_name | Value |+------------------+--------------------+| collation_server | utf8mb3_general_ci |+------------------+--------------------+1 row in set (0.001 sec)MariaDB [(none)]> - Create new test database and ensure it's collation:
MariaDB [(none)]> create database test_db;Query OK, 1 row affected (0.014 sec)MariaDB [(none)]> SELECT default_character_set_name, default_collation_name-> FROM information_schema.schemata-> WHERE schema_name = 'test_db';+----------------------------+------------------------+| default_character_set_name | default_collation_name |+----------------------------+------------------------+| utf8mb3 | utf8mb3_general_ci |+----------------------------+------------------------+1 row in set (0.001 sec) - Create test table and check it's collation
MariaDB [(none)]> use test_db;Database changedMariaDB [test_db]> CREATE TABLE `x509keypair` (-> `id` int(11) NOT NULL AUTO_INCREMENT,-> `created_at` datetime DEFAULT NULL,-> `updated_at` datetime DEFAULT NULL,-> `uuid` varchar(36) DEFAULT NULL,-> `certificate` text DEFAULT NULL,-> `private_key` text DEFAULT NULL,-> `project_id` varchar(255) DEFAULT NULL,-> `user_id` varchar(255) DEFAULT NULL,-> `intermediates` text DEFAULT NULL,-> `private_key_passphrase` text DEFAULT NULL,-> PRIMARY KEY (`id`),-> UNIQUE KEY `uniq_x509keypair0uuid` (`uuid`)-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;Query OK, 0 rows affected (0.025 sec)MariaDB [test_db]>MariaDB [test_db]> SELECT table_name, column_name, collation_name FROM information_schema.columns WHERE table_schema = 'test_db';+-------------+------------------------+-----------------------+| table_name | column_name | collation_name |+-------------+------------------------+-----------------------+| x509keypair | id | NULL || x509keypair | created_at | NULL || x509keypair | updated_at | NULL || x509keypair | uuid | utf8mb3_uca1400_ai_ci || x509keypair | certificate | utf8mb3_uca1400_ai_ci || x509keypair | private_key | utf8mb3_uca1400_ai_ci || x509keypair | project_id | utf8mb3_uca1400_ai_ci || x509keypair | user_id | utf8mb3_uca1400_ai_ci || x509keypair | intermediates | utf8mb3_uca1400_ai_ci || x509keypair | private_key_passphrase | utf8mb3_uca1400_ai_ci |+-------------+------------------------+-----------------------+10 rows in set (0.008 sec)MariaDB [test_db]>