summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-02-20 14:46:19 +0200
committerSergei Golubchik <serg@mariadb.org>2021-02-22 22:42:38 +0100
commit640f42311a72fa82bf7117c2791fc47ceb420361 (patch)
tree6135b491b2a6d6325f1f3d55c3f13779c80b90fb /sql/sql_show.cc
parent0ab1e3914c78e4a82a8e4502b58b20e5598727ab (diff)
downloadmariadb-git-640f42311a72fa82bf7117c2791fc47ceb420361.tar.gz
MDEV-24929 Server crash in thr_multi_unlock or in get_schema_tables_result
This was caused by two different bugs: 1) Information_schema tables where not locked by lock_tables, but get_lock_data() was not filtering these out. This caused a crash when mysql_unlock_some_tables() tried to unlock tables early, including not locked information schema tables. Fixed by not locking SYSTEM_TMP_TABLES 2) In some cases the optimizer will notice that we do not need to read the information_schema tables at all. In this case join_tab->read_record is not set, which caused a crash in get_schema_tables_result() Fixed by ignoring const tables in get_schema_tables_result()
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 2e0a44e4b8a..e6b5461e5af 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -8837,6 +8837,16 @@ bool get_schema_tables_result(JOIN *join,
if (table_list->schema_table->fill_table == 0)
continue;
+ /*
+ Do not fill in tables thare are marked as JT_CONST as these will never
+ be read and they also don't have a tab->read_record.table set!
+ This can happen with queries like
+ SELECT * FROM t1 LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.ROUTINES)
+ ON (t1b.a IS NULL);
+ */
+ if (tab->type == JT_CONST)
+ continue;
+
/* skip I_S optimizations specific to get_all_tables */
if (lex->describe &&
(table_list->schema_table->fill_table != get_all_tables))