• Konstantin Osipov's avatar
    Backport of: · 59f82702
    Konstantin Osipov authored
    ------------------------------------------------------------
    revno: 2617.69.32
    committer: Dmitry Lenev <dlenev@mysql.com>
    branch nick: mysql-next-bg46747
    timestamp: Wed 2009-08-19 18:12:27 +0400
    message:
      Fix for bug #46747 "Crash in MDL_ticket::upgrade_shared_lock_to_exclusive
      on TRIGGER + TEMP table".
    
      Server crashed when one tried to drop trigger which had its subject
      table shadowed by a temporary table with the same name.
    
      This problem occured because in such situation DROP TRIGGER has opened
      temporary table instead of base table on which trigger was defined.
      Attempt to upgrade metadata lock on this temporary table led to crash
      (we don't acquire metadata locks for temporary tables).
    
      This fix ensures that DROP TRIGGER ignores temporary tables when
      trying to open table on which trigger to be dropped is defined.
    
    
    mysql-test/r/trigger.result:
      Added test case for bug #46747 "Crash in
      MDL_ticket::upgrade_shared_lock_to_exclusive
      on TRIGGER + TEMP table".
    mysql-test/t/trigger.test:
      Added test case for bug #46747 "Crash in
      MDL_ticket::upgrade_shared_lock_to_exclusive
      on TRIGGER + TEMP table".
    sql/sql_trigger.cc:
      Prevent DROP TRIGGER from opening temporary table which might
      shadow base table on which trigger to be dropped is defined.
    59f82702
trigger.test 70.1 KB