summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-05-03 23:26:30 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2021-05-04 16:55:45 +0200
commita20195bba5ff695b8c00b8b3f57edced3c1108a6 (patch)
tree296ee6334ab5ea39513f4d7580a4a6fe25ced37e /sql/sql_derived.cc
parent72fa9dabadb4b0011f483ccbf1ef59e62d0ef1e0 (diff)
downloadmariadb-git-a20195bba5ff695b8c00b8b3f57edced3c1108a6.tar.gz
MDEV-21603 Crashing SHOW TABLES with derived table in WHERE conditionmariadb-10.2.38
When you only need view structure, don't call handle_derived with DT_CREATE and rely on its internal hackish check to skip DT_CREATE. Because handle_derived is called from many different places, and this internal hackish check is indiscriminative. Instead, just don't ask handle_derived to do DT_CREATE if you don't want it to do DT_CREATE.
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc7
1 files changed, 0 insertions, 7 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 5f90f2f9ab0..3ab93840d80 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -70,7 +70,6 @@ bool
mysql_handle_derived(LEX *lex, uint phases)
{
bool res= FALSE;
- THD *thd= lex->thd;
DBUG_ENTER("mysql_handle_derived");
DBUG_PRINT("enter", ("phases: 0x%x", phases));
if (!lex->derived_tables)
@@ -85,8 +84,6 @@ 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;
@@ -169,7 +166,6 @@ bool
mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases)
{
bool res= FALSE;
- THD *thd= lex->thd;
uint8 allowed_phases= (derived->is_merged_derived() ? DT_PHASES_MERGE :
DT_PHASES_MATERIALIZE);
DBUG_ENTER("mysql_handle_single_derived");
@@ -192,8 +188,6 @@ 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())
- break;
if ((res= (*processors[phase])(lex->thd, lex, derived)))
break;
@@ -1376,4 +1370,3 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
thd->lex->current_select= save_curr_select;
DBUG_RETURN(false);
}
-