diff options
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 17ea738443e..c5f8caedbb0 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1613,6 +1613,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) #ifdef WITH_PARTITION_STORAGE_ENGINE int part_names_error=0; #endif + bool from_share= false; DBUG_ENTER("open_table"); /* @@ -2021,6 +2022,7 @@ retry_share: /* Add table to the share's used tables list. */ tc_add_table(thd, table); + from_share= true; } table->mdl_ticket= mdl_ticket; @@ -2040,7 +2042,7 @@ retry_share: table_list->updatable= 1; // It is not derived table nor non-updatable VIEW table_list->table= table; - if (table->vcol_fix_exprs(thd)) + if (!from_share && table->vcol_fix_exprs(thd)) goto err_lock; #ifdef WITH_PARTITION_STORAGE_ENGINE @@ -5282,46 +5284,6 @@ static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table_list) } } -bool TABLE::vcol_fix_exprs(THD *thd) -{ - if (pos_in_table_list->placeholder() || !s->vcols_need_refixing || - pos_in_table_list->lock_type < TL_WRITE_ALLOW_WRITE) - return false; - - DBUG_ASSERT(pos_in_table_list != thd->lex->first_not_own_table()); - - bool result= true; - Security_context *save_security_ctx= thd->security_ctx; - Query_arena *stmt_backup= thd->stmt_arena; - if (thd->stmt_arena->is_conventional()) - thd->stmt_arena= expr_arena; - - if (pos_in_table_list->security_ctx) - thd->security_ctx= pos_in_table_list->security_ctx; - - - for (Field **vf= vfield; vf && *vf; vf++) - if ((*vf)->vcol_info->fix_session_expr(thd)) - goto end; - - for (Field **df= default_field; df && *df; df++) - if ((*df)->default_value && - (*df)->default_value->fix_session_expr(thd)) - goto end; - - for (Virtual_column_info **cc= check_constraints; cc && *cc; cc++) - if ((*cc)->fix_session_expr(thd)) - goto end; - - result= false; - -end: - thd->security_ctx= save_security_ctx; - thd->stmt_arena= stmt_backup; - - return result; -} - /** Lock all tables in a list. |