summaryrefslogtreecommitdiff
path: root/sql/sql_trigger.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2009-12-09 12:37:54 +0300
committerKonstantin Osipov <kostja@sun.com>2009-12-09 12:37:54 +0300
commit7fa9f986671a2b434a5f824baed27fa654ba7150 (patch)
tree44caba681d1acf8c1f22dafb73162564d126ad67 /sql/sql_trigger.cc
parent0104ea3ca022629c15d9b59ced959e2e638ac177 (diff)
downloadmariadb-git-7fa9f986671a2b434a5f824baed27fa654ba7150.tar.gz
Backport of:
------------------------------------------------------------ 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.
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r--sql/sql_trigger.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index f9d99b3c119..015e0d4daa1 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -443,6 +443,11 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
/* We also don't allow creation of triggers on views. */
tables->required_type= FRMTYPE_TABLE;
+ /*
+ Also prevent DROP TRIGGER from opening temporary table which might
+ shadow base table on which trigger to be dropped is defined.
+ */
+ tables->skip_temporary= TRUE;
/* Keep consistent with respect to other DDL statements */
mysql_ha_rm_tables(thd, tables);