diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 8090d8a9288..fe7ec83b845 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -5320,7 +5320,8 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type, end: if (table == NULL) { - trans_rollback_stmt(thd); + if (!thd->in_sub_stmt) + trans_rollback_stmt(thd); close_thread_tables(thd); } thd_proc_info(thd, 0);