diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 109c03742d12c9a9deea7ddb414c9a45b59d5bf0..292f9ebd344506302226090dfd8b8c33e046a378 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1142,7 +1142,7 @@ static int mysql_test_update(Prepared_statement *stmt, DBUG_ENTER("mysql_test_update"); if (update_precheck(thd, table_list) || - open_normal_and_derived_tables(thd, table_list, 0)) + open_tables(thd, &table_list, &table_count, 0)) goto error; if (table_list->multitable_view) @@ -1155,6 +1155,13 @@ static int mysql_test_update(Prepared_statement *stmt, DBUG_RETURN(2); } + /* + thd->fill_derived_tables() is false here for sure (because it is + preparation of PS, so we even do not check it). + */ + if (mysql_handle_derived(thd->lex, &mysql_derived_prepare)) + goto error; + #ifndef NO_EMBEDDED_ACCESS_CHECKS /* TABLE_LIST contain right privilages request */ want_privilege= table_list->grant.want_privilege;