summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 8662f1b799e..25cd1d8a9b4 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1790,6 +1790,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Invoked ROUTINE modified a transactional table but MySQL "
"failed to reflect this change in the binary log");
+ err_status= TRUE;
}
reset_dynamic(&thd->user_var_events);
/* Forget those values, in case more function calls are binlogged: */
@@ -2772,8 +2773,15 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
m_lex->mark_as_requiring_prelocking(NULL);
}
thd->rollback_item_tree_changes();
- /* Update the state of the active arena. */
- thd->stmt_arena->state= Query_arena::EXECUTED;
+ /*
+ Update the state of the active arena if no errors on
+ open_tables stage.
+ */
+ if (!res || !thd->is_error() ||
+ (thd->main_da.sql_errno() != ER_CANT_REOPEN_TABLE &&
+ thd->main_da.sql_errno() != ER_NO_SUCH_TABLE &&
+ thd->main_da.sql_errno() != ER_UPDATE_TABLE_USED))
+ thd->stmt_arena->state= Query_arena::EXECUTED;
/*
Merge here with the saved parent's values