• Davi Arnaut's avatar
    Bug#50423: Crash on second call of a procedure dropping a trigger · 6aad7676
    Davi Arnaut authored
    The problem was that a DROP TRIGGER statement inside a stored
    procedure could cause a crash in subsequent invocations. This
    was due to the addition, on the first execution, of a temporary
    table reference to the stored procedure query table list. In
    a subsequent invocation, there would be a attempt to reinitialize
    the temporary table reference, which by then was already gone.
    
    The solution is to backup and reset the query table list each
    time a trigger needs to be dropped. This ensures that any temp
    changes to the query table list are discarded. It is safe to
    do so at this time as drop trigger is restricted from more
    complicated scenarios (ie, not allowed within stored functions,
    etc).
    
    mysql-test/r/sp-bugs.result:
      Add test case result for Bug#50423
    mysql-test/t/sp-bugs.test:
      Add test case for Bug#50423
    sql/sql_trigger.cc:
      Backup and reset the query table list.
      Remove now unnecessary manual reset of the query table list.
    6aad7676
sql_trigger.cc 68.3 KB