diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2021-04-23 16:00:29 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2021-04-23 19:02:38 +0300 |
commit | 55491d94a6c0d61f9db9ef5bb7950e2417411633 (patch) | |
tree | 85b6b315120dd9946106541a280b8b9d9b5dc5a1 /sql/sql_derived.cc | |
parent | 75c01f39b1b4a6d27d36d075f8baab9bdda7cc7e (diff) | |
download | mariadb-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_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 50b0178c6c9..33cb6a50710 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -85,14 +85,16 @@ mysql_handle_derived(LEX *lex, uint phases) break; if (!(phases & phase_flag)) continue; - if (phase_flag >= DT_CREATE && !thd->fill_derived_tables()) - break; for (SELECT_LEX *sl= lex->all_selects_list; sl && !res; sl= sl->next_select_in_list()) { TABLE_LIST *cursor= sl->get_table_list(); + + if (phase_flag >= DT_CREATE && !thd->fill_derived_table(cursor)) + break; + sl->changed_elements|= TOUCHED_SEL_DERIVED; /* DT_MERGE_FOR_INSERT is not needed for views/derived tables inside @@ -193,7 +195,7 @@ mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases) if (phase_flag != DT_PREPARE && !(allowed_phases & phase_flag)) continue; - if (phase_flag >= DT_CREATE && !thd->fill_derived_tables()) + if (phase_flag >= DT_CREATE && !thd->fill_derived_table(derived)) break; if ((res= (*processors[phase])(lex->thd, lex, derived))) |