mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-25462: Assertion `m_status == DA_ERROR || m_status == DA_OK ||
m_status == DA_OK_BULK' failed in Diagnostics_area::message from get_schema_tables_record Analysis: SET NAMES changes character set for character_set_client, character_set_connection, character_set_results to 'filename'. The .frm file of view has @xx sequences in the SELECT query, which give parsing error because 'filename' character set is not parser friendly. When we get parsing error (ER_PARSE_ERROR), we directly return true without setting error status. This is caught later in assertion. Fix: Disallow 'filename' character set in SET NAMES because it is not parser friendly.
This commit is contained in:
parent
406ce57232
commit
629449172a
4 changed files with 63 additions and 1 deletions
|
@ -21,3 +21,32 @@ SET NAMES utf8;
|
|||
SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@a));
|
||||
@a BINARY @a REVERSE(@a) HEX(@a) HEX(REVERSE(@a))
|
||||
aя a@r1 яa 61407231 40723161
|
||||
#
|
||||
# Beginning of 10.2 test.
|
||||
#
|
||||
# MDEV-25462: Assertion `m_status == DA_ERROR || m_status == DA_OK ||
|
||||
# m_status == DA_OK_BULK' failed in Diagnostics_area::message from
|
||||
# get_schema_tables_record
|
||||
#
|
||||
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
|
||||
@@character_set_client @@character_set_connection @@character_set_results
|
||||
utf8 utf8 utf8
|
||||
SET @old_character_set_client= @@character_set_client;
|
||||
SET @old_character_set_connection= @@character_set_connection;
|
||||
SET @old_character_set_results= @@character_set_results;
|
||||
SET NAMES 'filename';
|
||||
ERROR 42000: Variable 'character_set_client' can't be set to the value of 'filename'
|
||||
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
|
||||
@@character_set_client @@character_set_connection @@character_set_results
|
||||
utf8 utf8 utf8
|
||||
CREATE VIEW v2 AS SELECT 1;
|
||||
SHOW TABLE STATUS;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
v2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW
|
||||
DROP VIEW v2;
|
||||
SET @@character_set_client= @old_character_set_client;
|
||||
SET @@character_set_connection= @old_character_set_connection;
|
||||
SET @@character_set_results= @old_character_set_results;
|
||||
#
|
||||
# End of 10.2 test
|
||||
#
|
||||
|
|
|
@ -27,3 +27,29 @@ select convert(convert(',' using filename) using binary);
|
|||
--echo #
|
||||
SET NAMES utf8;
|
||||
SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@a));
|
||||
|
||||
--echo #
|
||||
--echo # Beginning of 10.2 test.
|
||||
--echo #
|
||||
--echo # MDEV-25462: Assertion `m_status == DA_ERROR || m_status == DA_OK ||
|
||||
--echo # m_status == DA_OK_BULK' failed in Diagnostics_area::message from
|
||||
--echo # get_schema_tables_record
|
||||
--echo #
|
||||
|
||||
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
|
||||
SET @old_character_set_client= @@character_set_client;
|
||||
SET @old_character_set_connection= @@character_set_connection;
|
||||
SET @old_character_set_results= @@character_set_results;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET NAMES 'filename';
|
||||
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
|
||||
CREATE VIEW v2 AS SELECT 1;
|
||||
SHOW TABLE STATUS;
|
||||
DROP VIEW v2;
|
||||
SET @@character_set_client= @old_character_set_client;
|
||||
SET @@character_set_connection= @old_character_set_connection;
|
||||
SET @@character_set_results= @old_character_set_results;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 test
|
||||
--echo #
|
||||
|
|
|
@ -921,7 +921,7 @@ mysqld_collation_get_by_name(const char *name,
|
|||
|
||||
static inline bool is_supported_parser_charset(CHARSET_INFO *cs)
|
||||
{
|
||||
return MY_TEST(cs->mbminlen == 1);
|
||||
return MY_TEST(cs->mbminlen == 1 && cs->number != 17 /* filename */);
|
||||
}
|
||||
|
||||
#ifdef MYSQL_SERVER
|
||||
|
|
|
@ -878,6 +878,13 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
|||
{
|
||||
LEX *lex= thd->lex;
|
||||
|
||||
/*
|
||||
Ensure character set number != 17 (character set = filename) and mbminlen=1
|
||||
because these character sets are not parser friendly, which can give weird
|
||||
sequence in .frm file of view and later give parsing error.
|
||||
*/
|
||||
DBUG_ASSERT(thd->charset()->mbminlen == 1 && thd->charset()->number != 17);
|
||||
|
||||
/*
|
||||
View definition query -- a SELECT statement that fully defines view. It
|
||||
is generated from the Item-tree built from the original (specified by
|
||||
|
|
Loading…
Add table
Reference in a new issue