[MDEV-29776] collation_connection and db_collation are too short in mysql.proc and mysql.event Created: 2022-10-12  Updated: 2022-10-14  Resolved: 2022-10-14

Status: Closed
Project: MariaDB Server
Component/s: Character Sets, Data types
Affects Version/s: None
Fix Version/s: 10.10.2, 10.11.1

Type: Bug Priority: Blocker
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-27009 Add UCA-14.0.0 collations Closed
Relates
relates to MDEV-29763 ER_EVENT_STORE_FAILED upon creating e... Open

 Description   

The patch for MDEV-27009 changed the maximum collation name size from 32 to 64:

-#define MY_CS_NAME_SIZE                        32
+#define MY_CS_CHARACTER_SET_NAME_SIZE   32
+#define MY_CS_COLLATION_NAME_SIZE       64

INFORMATION_SCHEMA tables were fixed accordinly. However, tables mysql.proc and mysql.event were forgotten:

SELECT table_schema, table_name, column_name, column_type
FROM information_schema.columns WHERE column_name LIKE '%colla%';

+--------------------+---------------------------------------+------------------------+-------------+
| table_schema       | table_name                            | column_name            | column_type |
+--------------------+---------------------------------------+------------------------+-------------+
| mysql              | proc                                  | collation_connection   | char(32)    |
| mysql              | proc                                  | db_collation           | char(32)    |
| mysql              | event                                 | collation_connection   | char(32)    |
| mysql              | event                                 | db_collation           | char(32)    |
| information_schema | CHARACTER_SETS                        | DEFAULT_COLLATE_NAME   | varchar(64) |
| information_schema | COLLATIONS                            | COLLATION_NAME         | varchar(64) |
| information_schema | COLLATION_CHARACTER_SET_APPLICABILITY | COLLATION_NAME         | varchar(64) |
| information_schema | COLLATION_CHARACTER_SET_APPLICABILITY | FULL_COLLATION_NAME    | varchar(64) |
| information_schema | COLUMNS                               | COLLATION_NAME         | varchar(64) |
| information_schema | EVENTS                                | COLLATION_CONNECTION   | varchar(64) |
| information_schema | EVENTS                                | DATABASE_COLLATION     | varchar(64) |
| information_schema | PARAMETERS                            | COLLATION_NAME         | varchar(64) |
| information_schema | ROUTINES                              | COLLATION_NAME         | varchar(64) |
| information_schema | ROUTINES                              | COLLATION_CONNECTION   | varchar(64) |
| information_schema | ROUTINES                              | DATABASE_COLLATION     | varchar(64) |
| information_schema | SCHEMATA                              | DEFAULT_COLLATION_NAME | varchar(64) |
| information_schema | STATISTICS                            | COLLATION              | varchar(1)  |
| information_schema | TABLES                                | TABLE_COLLATION        | varchar(64) |
| information_schema | TRIGGERS                              | COLLATION_CONNECTION   | varchar(64) |
| information_schema | TRIGGERS                              | DATABASE_COLLATION     | varchar(64) |
| information_schema | VIEWS                                 | COLLATION_CONNECTION   | varchar(64) |
+--------------------+---------------------------------------+------------------------+-------------+

Some new collation names do not fit into 32 characters:

SET NAMES 'utf8mb3' COLLATE 'utf8mb3_uca1400_swedish_nopad_ai_ci';
CREATE FUNCTION f1() RETURNS INT RETURN 1;

ERROR 1607 (HY000): Cannot create stored routine `f1`. Check warnings

SHOW WARNINGS;

+---------+------+--------------------------------------------------------------+
| Level   | Code | Message                                                      |
+---------+------+--------------------------------------------------------------+
| Warning | 1265 | Data truncated for column 'collation_connection' at row 3226 |
| Error   | 1607 | Cannot create stored routine `f1`. Check warnings            |
+---------+------+--------------------------------------------------------------+

Definitions for mysql.proc and mysql.event should be updated to use char(64) as the data type for the mentioned columns.



 Comments   
Comment by Alexander Barkov [ 2022-10-12 ]

Hello serg, please review a patch:

https://github.com/MariaDB/server/commit/1a016e9524c8efae0667bf3cbe104c7316fab023

Comment by Sergei Golubchik [ 2022-10-13 ]

1a016e9524c is ok to push

Generated at Thu Feb 08 10:11:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.