summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-06-06 17:10:57 +0200
committerSergei Golubchik <serg@mariadb.org>2019-06-07 18:41:08 +0200
commit973b281e599e6126c58c8398211dfe306644e517 (patch)
tree02a86ec9908aae6e6d593d3217ece7bcafba5505 /sql/sql_statistics.cc
parent06291c3f36c6b768e6ce1db986a0f103abe71b57 (diff)
downloadmariadb-git-973b281e599e6126c58c8398211dfe306644e517.tar.gz
MDEV-18788 Live upgrade from MySQL 5.6/5.7 to MariaDB 10.4 fails with "Event Scheduler: An error occurred when initializing system tables"
if columns or indexes are modified/renamed/dropped in an ALTER TABLE, stat tables must be updated accordingly (e.g. all statistics for a column should be dropped). But if a stat table doesn't exist, it's not a reason to fail the whole ALTER TABLE operation - such an error should be ignored.
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r--sql/sql_statistics.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index b1337a89da9..8c170b7df52 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -273,7 +273,11 @@ static inline int open_stat_table_for_ddl(THD *thd, TABLE_LIST *table,
Open_tables_backup *backup)
{
table->init_one_table(&MYSQL_SCHEMA_NAME, stat_tab_name, NULL, TL_WRITE);
- return open_system_tables_for_read(thd, table, backup);
+ No_such_table_error_handler nst_handler;
+ thd->push_internal_handler(&nst_handler);
+ int res= open_system_tables_for_read(thd, table, backup);
+ thd->pop_internal_handler();
+ return res;
}