summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-04-23 16:00:29 +0300
committerSergei Petrunia <psergey@askmonty.org>2021-04-23 19:02:38 +0300
commit55491d94a6c0d61f9db9ef5bb7950e2417411633 (patch)
tree85b6b315120dd9946106541a280b8b9d9b5dc5a1 /sql/sql_class.h
parent75c01f39b1b4a6d27d36d075f8baab9bdda7cc7e (diff)
downloadmariadb-git-bb-10.3-mdev21603.tar.gz
MDEV-21603: Long WHERE IN mariadb 10.3.22 crashbb-10.3-mdev21603
I_S tables and SHOW COMMANDS use special logic for creating and populating temp.tables, e.g. table creation is delayed. The code attempted to apply the same logic for the IN-to-SELECT temptable, which resulted in an attempt to read from not-yet-created temptable and crash. Fix this by restricting use of I_S table logic only to I_S tables.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 5ab93de7957..de2dab3cc14 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3636,9 +3636,17 @@ public:
{
return server_status & SERVER_STATUS_IN_TRANS;
}
- inline bool fill_derived_tables()
+ inline bool fill_derived_table(TABLE_LIST *tl)
{
- return !stmt_arena->is_stmt_prepare() && !lex->only_view_structure();
+ /*
+ Do not fill derived table when
+ 1. running a PREPARE command
+ 2. this is a SHOW command and the table is a temp.table representing
+ the I_S table.
+ */
+ return !stmt_arena->is_stmt_prepare() && // (1)
+ !(lex->only_view_structure() && tl? tl->schema_table_reformed:false); // (2)
+
}
inline bool fill_information_schema_tables()
{