mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
MDEV-7922 - ERROR 1939 (HY000): Engine PERFORMANCE_SCHEMA failed to discover
table Performance schema discovery fails if connection has no active database set. This happened due to restriction in SQL parser: table name with no database name is ambiguous in such case. Fixed by temporary substitution of default database with being discovered table database.
This commit is contained in:
12
mysql-test/suite/perfschema/r/discovery.result
Normal file
12
mysql-test/suite/perfschema/r/discovery.result
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# MDEV-7922 - ERROR 1939 (HY000): Engine PERFORMANCE_SCHEMA failed to
|
||||
# discover table
|
||||
#
|
||||
FLUSH TABLES;
|
||||
CREATE DATABASE test_drop;
|
||||
USE test_drop;
|
||||
DROP DATABASE test_drop;
|
||||
SELECT TABLE_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='performance_schema';
|
||||
SELECT @@warning_count;
|
||||
@@warning_count
|
||||
0
|
||||
15
mysql-test/suite/perfschema/t/discovery.test
Normal file
15
mysql-test/suite/perfschema/t/discovery.test
Normal file
@@ -0,0 +1,15 @@
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_perfschema.inc
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-7922 - ERROR 1939 (HY000): Engine PERFORMANCE_SCHEMA failed to
|
||||
--echo # discover table
|
||||
--echo #
|
||||
FLUSH TABLES;
|
||||
CREATE DATABASE test_drop;
|
||||
USE test_drop;
|
||||
DROP DATABASE test_drop;
|
||||
--disable_result_log
|
||||
SELECT TABLE_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='performance_schema';
|
||||
--enable_result_log
|
||||
SELECT @@warning_count;
|
||||
@@ -2158,6 +2158,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
|
||||
uint unused2;
|
||||
handlerton *hton= plugin_hton(db_plugin);
|
||||
LEX_CUSTRING frm= {0,0};
|
||||
LEX_STRING db_backup= { thd->db, thd->db_length };
|
||||
|
||||
DBUG_ENTER("TABLE_SHARE::init_from_sql_statement_string");
|
||||
|
||||
@@ -2185,6 +2186,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
|
||||
else
|
||||
thd->set_n_backup_active_arena(arena, &backup);
|
||||
|
||||
thd->reset_db(db.str, db.length);
|
||||
lex_start(thd);
|
||||
|
||||
if ((error= parse_sql(thd, & parser_state, NULL) ||
|
||||
@@ -2213,6 +2215,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
|
||||
ret:
|
||||
my_free(const_cast<uchar*>(frm.str));
|
||||
lex_end(thd->lex);
|
||||
thd->reset_db(db_backup.str, db_backup.length);
|
||||
thd->lex= old_lex;
|
||||
if (arena)
|
||||
thd->restore_active_arena(arena, &backup);
|
||||
|
||||
Reference in New Issue
Block a user