Loading mysql-test/r/trigger.result +2 −1 Original line number Diff line number Diff line Loading @@ -297,7 +297,7 @@ drop trigger t1.trg; ERROR HY000: Trigger does not exist create view v1 as select * from t1; create trigger trg before insert on v1 for each row set @a:=1; ERROR HY000: Trigger's 'v1' is view or temporary table ERROR HY000: 'test.v1' is not BASE TABLE drop view v1; drop table t1; create temporary table t1 (i int); Loading Loading @@ -578,4 +578,5 @@ create trigger t1_bu before update on t1 for each row set new.col1= bug5893(); drop function bug5893; update t1 set col2 = 4; ERROR 42000: FUNCTION test.bug5893 does not exist drop trigger t1.t1_bu; drop table t1; mysql-test/t/trigger.test +5 −1 Original line number Diff line number Diff line Loading @@ -317,7 +317,7 @@ drop trigger t1.trg; drop trigger t1.trg; create view v1 as select * from t1; --error 1361 --error 1347 create trigger trg before insert on v1 for each row set @a:=1; drop view v1; Loading Loading @@ -576,6 +576,8 @@ drop table t1, t2; # Test for bug #5893 "Triggers with dropped functions cause crashes" # Appropriate error should be reported instead of crash. # Also test for bug #11889 "Server crashes when dropping trigger # using stored routine". --disable_warnings drop function if exists bug5893; --enable_warnings Loading @@ -586,4 +588,6 @@ create trigger t1_bu before update on t1 for each row set new.col1= bug5893(); drop function bug5893; --error 1305 update t1 set col2 = 4; # This should not crash server too. drop trigger t1.t1_bu; drop table t1; sql/sql_trigger.cc +4 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,10 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) But do we want this ? */ if (open_and_lock_tables(thd, tables)) /* We should have only one table in table list. */ DBUG_ASSERT(tables->next_global == 0); if (!(table= open_ltable(thd, tables, tables->lock_type))) DBUG_RETURN(TRUE); /* Loading @@ -80,8 +83,6 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) if (check_global_access(thd, SUPER_ACL)) DBUG_RETURN(TRUE); table= tables->table; /* We do not allow creation of triggers on views or temporary tables. We have to do this check here and not in Loading Loading
mysql-test/r/trigger.result +2 −1 Original line number Diff line number Diff line Loading @@ -297,7 +297,7 @@ drop trigger t1.trg; ERROR HY000: Trigger does not exist create view v1 as select * from t1; create trigger trg before insert on v1 for each row set @a:=1; ERROR HY000: Trigger's 'v1' is view or temporary table ERROR HY000: 'test.v1' is not BASE TABLE drop view v1; drop table t1; create temporary table t1 (i int); Loading Loading @@ -578,4 +578,5 @@ create trigger t1_bu before update on t1 for each row set new.col1= bug5893(); drop function bug5893; update t1 set col2 = 4; ERROR 42000: FUNCTION test.bug5893 does not exist drop trigger t1.t1_bu; drop table t1;
mysql-test/t/trigger.test +5 −1 Original line number Diff line number Diff line Loading @@ -317,7 +317,7 @@ drop trigger t1.trg; drop trigger t1.trg; create view v1 as select * from t1; --error 1361 --error 1347 create trigger trg before insert on v1 for each row set @a:=1; drop view v1; Loading Loading @@ -576,6 +576,8 @@ drop table t1, t2; # Test for bug #5893 "Triggers with dropped functions cause crashes" # Appropriate error should be reported instead of crash. # Also test for bug #11889 "Server crashes when dropping trigger # using stored routine". --disable_warnings drop function if exists bug5893; --enable_warnings Loading @@ -586,4 +588,6 @@ create trigger t1_bu before update on t1 for each row set new.col1= bug5893(); drop function bug5893; --error 1305 update t1 set col2 = 4; # This should not crash server too. drop trigger t1.t1_bu; drop table t1;
sql/sql_trigger.cc +4 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,10 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) But do we want this ? */ if (open_and_lock_tables(thd, tables)) /* We should have only one table in table list. */ DBUG_ASSERT(tables->next_global == 0); if (!(table= open_ltable(thd, tables, tables->lock_type))) DBUG_RETURN(TRUE); /* Loading @@ -80,8 +83,6 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) if (check_global_access(thd, SUPER_ACL)) DBUG_RETURN(TRUE); table= tables->table; /* We do not allow creation of triggers on views or temporary tables. We have to do this check here and not in Loading