diff options
author | Michael Widenius <monty@askmonty.org> | 2011-10-06 16:56:59 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-10-06 16:56:59 +0300 |
commit | 9c32088322f69155d91f6033319ebb03d108f044 (patch) | |
tree | 159ff05f36694d017d5c5a62d559a0c9ef1f5b21 /mysql-test | |
parent | 5f607a2c705063ef23a9974b34151a991e80538f (diff) | |
download | mariadb-git-9c32088322f69155d91f6033319ebb03d108f044.tar.gz |
Fixed that when using a trigger mysql.proc is now accessed
Cleanup: Changed procedure type from a int/char to an enum for easier to manage and debug code.
mysql-test/r/trigger.result:
Test that mysql.proc is not used as part of creating or using a trigger.
mysql-test/t/trigger.test:
Test that mysql.proc is not used as part of creating or using a trigger.
sql/sp.cc:
The main bug fix is to not look up triggers in mysql.proc; This is done by ignoreing type == TYPE_ENUM_TRIGGER in sp_add_used_routine()
Cleanup: Changed procedure type from a int/char to an enum.
sql/sp.h:
Cleanup: Changed procedure type from a int/char to an enum.
sql/sp_head.h:
Cleanup: Changed procedure type from a int/char to an enum.
sql/sql_db.cc:
Fix include order
sql/sql_lex.cc:
Fix include order
sql/sql_parse.cc:
Cleanup: Changed procedure type from a int/char to an enum.
sql/sql_show.cc:
Fix include order
sql/sql_view.cc:
Fix include order
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/trigger.result | 19 | ||||
-rw-r--r-- | mysql-test/t/trigger.test | 25 |
2 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 089845560ed..efe63285c9c 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -2117,3 +2117,22 @@ b DROP DATABASE db1; USE test; End of 5.1 tests. +create table t1 (i int); +create table t2 (i int); +flush tables; +flush status; +CREATE DEFINER=`root`@`localhost` TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW BEGIN DELETE FROM t2 WHERE t2.i = OLD.i; END // +insert into t1 values (1),(2); +insert into t2 values (1),(2); +delete from t1 where i=1; +show status like 'Opened_tables'; +Variable_name Value +Opened_tables 3 +select * from t1; +i +2 +select * from t2; +i +2 +drop table t1,t2; +End of 5.2 tests. diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index a968e146d20..8d84330ec44 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -2409,3 +2409,28 @@ DROP DATABASE db1; USE test; --echo End of 5.1 tests. + +# +# Test that using a trigger will not open mysql.proc +# + +create table t1 (i int); +create table t2 (i int); +flush tables; +flush status; +delimiter //; +CREATE DEFINER=`root`@`localhost` TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW BEGIN DELETE FROM t2 WHERE t2.i = OLD.i; END // +delimiter ;// +insert into t1 values (1),(2); +insert into t2 values (1),(2); +delete from t1 where i=1; +# +# If mysql.proc would be used we would have 4 here. 3 is the correct number. +# (CREATE TRIGGER will open t1 and then flush it) +# +show status like 'Opened_tables'; +select * from t1; +select * from t2; +drop table t1,t2; + +--echo End of 5.2 tests. |