diff --git a/sql/dd/upgrade/table.cc b/sql/dd/upgrade/table.cc index 3d51c3c220ab..e9f0b2d40dca 100644 --- a/sql/dd/upgrade/table.cc +++ b/sql/dd/upgrade/table.cc @@ -1634,6 +1634,7 @@ static bool migrate_table_to_dd(THD *thd, } // Object to handle cleanup. + LEX lex; Table_upgrade_guard table_guard(thd, table, &table->mem_root); // Dont upgrade tables, we are fixing dependency for views. @@ -1789,7 +1790,6 @@ static bool migrate_table_to_dd(THD *thd, // open_table_from_share and partition expression parsing needs a // valid SELECT_LEX to parse generated columns LEX *lex_saved= thd->lex; - LEX lex; thd->lex= &lex; lex_start(thd); table_guard.update_lex(lex_saved);