diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 9bbcaffa5dd..904909a53fa 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -642,13 +642,13 @@ sp_head::execute(THD *thd) items made during other permanent subquery transformations). */ thd->current_arena= i; + ret= i->execute(thd, &ip); /* - no_send_error may have been set by the previous SP instruction when it - sent eof. Allow the current SP instruction to produce an error. - (multi-statement execution code clears no_send_error, too) + If this SP instruction have sent eof, it has caused no_send_error to be + set. Clear it back to allow the next instruction to send error. (multi- + statement execution code clears no_send_error between statements too) */ thd->net.no_send_error= 0; - ret= i->execute(thd, &ip); if (i->free_list) cleanup_items(i->free_list); i->state= Query_arena::EXECUTED;