MDEV-18929 2nd execution of SP does not detect ER_VERS_NOT_VERSIONED

Related to 87731177 and Bug#47649.

Don't set Query_arena::STMT_EXECUTED for any error
code. skip_setup_conds() depends on STMT_INITIALIZED_FOR_SP, but
sp_lex_keeper::reset_lex_and_exec_core() sets it to STMT_EXECUTED on
ER_TABLE_NOT_LOCKED_FOR_WRITE. There are other error codes that can
break skip_setup_conds() (ER_IT_IS_A_VIEW, ER_NON_UPDATABLE_TABLE,
etc).
This commit is contained in:
Aleksey Midenkov 2019-12-03 21:26:44 +03:00
parent 477629d2cd
commit f6d8640d67

View File

@ -3379,11 +3379,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
Update the state of the active arena if no errors on
open_tables stage.
*/
if (likely(!res) || likely(!thd->is_error()) ||
(thd->get_stmt_da()->sql_errno() != ER_CANT_REOPEN_TABLE &&
thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE &&
thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE_IN_ENGINE &&
thd->get_stmt_da()->sql_errno() != ER_UPDATE_TABLE_USED))
if (likely(!res) || likely(!thd->is_error()))
thd->stmt_arena->state= Query_arena::STMT_EXECUTED;
/*