1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

don't set derived->merged until derived is really irreversibly merged

it was set before big if() that could decide not to merge and
go with materialization.

this fixes a crash in main.view test
This commit is contained in:
Sergei Golubchik
2018-02-05 16:00:13 +01:00
parent 4771ae4b22
commit c4930a820a

View File

@ -388,7 +388,6 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
thd->save_prep_leaf_list= TRUE;
arena= thd->activate_stmt_arena_if_needed(&backup); // For easier test
derived->merged= TRUE;
if (!derived->merged_for_insert ||
(derived->is_multitable() &&
@ -452,6 +451,7 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
if (parent_lex->join)
parent_lex->join->table_count+= dt_select->join->table_count - 1;
}
derived->merged= TRUE;
if (derived->get_unit()->prepared)
{
Item *expr= derived->on_expr;