• Dmitry Shulga's avatar
    MDEV-33525: Recreate/reuse temporary table · b620b394
    Dmitry Shulga authored
    Calling a stored function that uses a cursor inside its body
    could produce the error ER_NO_SUCH_TABLE on the second execution
    in case the cursor uses multi-table query and one of the tables
    is a temporary table just created before querying the cursor and
    dropped just after the query has been executed.
    
    The reason for issue is that re-parsing of failed a SP instruction
    caused be create/drop of the temporary table used LEX object
    left from previous parsing of a SP instruction's query instead
    re-initialize the lex object before parsing.
    
    To fix the issue, add initialization of lex for cursor's
    statement before re-parsing the query of a failed SP instruction.
    b620b394
sp_validation.test 59.3 KB