1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-28769 Assertion `(m_ci->state & 32) || m_with_collate' failed in Lex_exact_charset_opt_extended_collate::Lex_exact_charset_opt_extended_collate on SET NAMES

These system variables:
  @@character_set_client
  @@character_set_connection
  @@character_set_database
  @@character_set_filesystem
  @@character_set_results
  @@character_set_server

can now be set in numeric format only to IDs of default collations, e.g.:

SET @@character_set_xxx=9;  -- OK    (latin2_general_ci  is default)
SET @@character_set_xxx=2;  -- ERROR (latin2_czech_cs is not default)
SET @@character_set_xxx=21; -- ERROR (latin2_hungarian_ci is not default)

Before this change the server accepted IDs of non-default collations
so all three examples above worked without errors,
but this could lead to unexpected behavior in later statements.
This commit is contained in:
Alexander Barkov
2022-06-16 10:38:35 +04:00
parent 9fe784ff7e
commit a923d6f49c
13 changed files with 168 additions and 89 deletions

View File

@@ -229,33 +229,44 @@ SELECT @@global.character_set_client;
##############################################################
SET @@character_set_client = 1;
SELECT @@character_set_client;
--echo # latin2_czech_cs is not a default collation
--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_client = 2;
SELECT @@character_set_client;
SET @@character_set_client = 3;
SELECT @@character_set_client;
SET @@character_set_client = 36;
SELECT @@character_set_client;
SET @@character_set_client = 99;
SELECT @@character_set_client;
--echo # cp1250_polish_ci is not a default collation
--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_client = 99;
--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_client = 100;
SET @@global.character_set_client = 1;
SELECT @@global.character_set_client;
--echo # latin2_czech_cs is not a default collation
--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_client = 2;
SELECT @@global.character_set_client;
SET @@global.character_set_client = 3;
SELECT @@global.character_set_client;
SET @@global.character_set_client = 36;
SELECT @@global.character_set_client;
SET @@global.character_set_client = 99;
SELECT @@global.character_set_client;
--echo # cp1250_polish_ci is not a default collation
--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_client = 99;
--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_client = 100;
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
SELECT @total_charset;
@@ -332,6 +343,13 @@ SELECT @@session.character_set_client =
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='character_set_client') AS res;
--echo #
--echo # MDEV-28769 Assertion `(m_ci->state & 32) || m_with_collate' failed in Lex_exact_charset_opt_extended_collate::Lex_exact_charset_opt_extended_collate on SET NAMES
--echo #
--error ER_UNKNOWN_CHARACTER_SET
SET GLOBAL character_set_client=2;
####################################
# Restore initial value #
####################################