• Dmitry Shulga's avatar
    Fixed bug#54375 - Error in stored procedure leaves connection · af132f15
    Dmitry Shulga authored
    in different default schema.
    
    In strict mode, when data truncation or conversion happens,
    THD::killed is set to THD::KILL_BAD_DATA.
    
    This is abuse of KILL mechanism to guarantee that execution
    of statement is aborted.
    
    The stored procedures execution, on the other hand,
    upon detection that a connection was killed, would
    terminate immediately, without trying to restore the caller's
    context, in particular, restore the caller's current schema.
    
    The fix is, when terminating a stored procedure execution,
    to only bypass cleanup if the entire connection was killed,
    not in case of other forms of KILL.
    
    
    mysql-test/r/sp-bugs.result:
      Added result for a test case for bug#54375.
    mysql-test/t/sp-bugs.test:
      Added test case for bug#54375.
    sql/sp_head.cc:
      sp_head::execute modified: restore saved current db if
      connection is not killed.
    af132f15
sp-bugs.test 2.84 KB