diff options
author | Monty <monty@mariadb.org> | 2016-10-02 15:35:08 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2016-10-05 01:11:07 +0300 |
commit | 8be53a389c8eebed337057fa366b7c4506ba16b1 (patch) | |
tree | abd36c95a598f1d6e5537e94fd7de034715ce299 /mysql-test/suite/roles | |
parent | 0bae1957dd124f8382ae6af1de0e2168fc200bfb (diff) | |
download | mariadb-git-8be53a389c8eebed337057fa366b7c4506ba16b1.tar.gz |
MDEV-6112 multiple triggers per table
This is similar to MysQL Worklog 3253, but with
a different implementation. The disk format and
SQL syntax is identical with MySQL 5.7.
Fetures supported:
- "Any" ammount of any trigger
- Supports FOLLOWS and PRECEDES to be
able to put triggers in a certain execution order.
Implementation details:
- Class Trigger added to hold information about a trigger.
Before this trigger information was stored in a set of lists in
Table_triggers_list and in Table_triggers_list::bodies
- Each Trigger has a next field that poinst to the next Trigger with the
same action and time.
- When accessing a trigger, we now always access all linked triggers
- The list are now only used to load and save trigger files.
- MySQL trigger test case (trigger_wl3253) added and we execute these
identically.
- Even more gracefully handling of wrong trigger files than before. This
is useful if a trigger file uses functions or syntax not provided by
the server.
- Each trigger now has a "Created" field that shows when the trigger was
created, with 2 decimals.
Other comments:
- Many of the changes in test files was done because of the new "Created"
field in the trigger file. This shows up in SHOW ... TRIGGER and when
using information_schema.trigger.
- Don't check if all memory is released if on uses --gdb; This is needed
to be able to get a list from safemalloc of not freed memory while
debugging.
- Added option to trim_whitespace() to know how many prefix characters
was skipped.
- Changed a few ulonglong sql_mode to sql_mode_t, to find some wrong usage
of sql_mode.
Diffstat (limited to 'mysql-test/suite/roles')
-rw-r--r-- | mysql-test/suite/roles/definer.result | 16 | ||||
-rw-r--r-- | mysql-test/suite/roles/definer.test | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result index 4810e597763..e3b2d6ac758 100644 --- a/mysql-test/suite/roles/definer.result +++ b/mysql-test/suite/roles/definer.result @@ -108,9 +108,9 @@ set role role1; create definer=current_role trigger tr1 before insert on t2 for each row insert t1 values (111, 222, 333); show create trigger tr1; -Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created tr1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role1` trigger tr1 before insert on t2 for each row -insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci # set role none; insert t2 values (11,22,33); ERROR 42000: INSERT command denied to user ''@'' for table 't1' @@ -125,9 +125,9 @@ a b c create definer=role2 trigger tr2 before delete on t2 for each row insert t1 values (111, 222, 333); show create trigger tr2; -Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created tr2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role2` trigger tr2 before delete on t2 for each row -insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci # delete from t2 where a=1; select * from t1; a b c @@ -143,9 +143,9 @@ insert t1 values (111, 222, 333); Warnings: Note 1449 The user specified as a definer ('role3'@'%') does not exist show create trigger tr3; -Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created tr3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role3`@`%` trigger tr3 before update on t2 for each row -insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci # update t2 set b=2 where a=2; ERROR HY000: The user specified as a definer ('role3'@'%') does not exist select * from t1; @@ -157,9 +157,9 @@ a b c 2 20 200 flush tables; show create trigger tr2; -Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created tr2 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role2`@`` trigger tr2 before delete on t2 for each row -insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci # delete from t2 where a=2; ERROR HY000: The user specified as a definer ('role2'@'%') does not exist select * from t1; diff --git a/mysql-test/suite/roles/definer.test b/mysql-test/suite/roles/definer.test index 090c60917c9..a4a65a77a9b 100644 --- a/mysql-test/suite/roles/definer.test +++ b/mysql-test/suite/roles/definer.test @@ -138,6 +138,7 @@ create definer=current_role trigger tr1 before insert on t2 for each row set role role1; create definer=current_role trigger tr1 before insert on t2 for each row insert t1 values (111, 222, 333); +--replace_column 7 # show create trigger tr1; set role none; @@ -149,6 +150,7 @@ select * from t2; # definer=role_name, privileges ok create definer=role2 trigger tr2 before delete on t2 for each row insert t1 values (111, 222, 333); +--replace_column 7 # show create trigger tr2; delete from t2 where a=1; select * from t1; @@ -158,6 +160,7 @@ delete from t1 where a=111; # definer=non_existent_role create definer=role3 trigger tr3 before update on t2 for each row insert t1 values (111, 222, 333); +--replace_column 7 # show create trigger tr3; --error ER_NO_SUCH_USER update t2 set b=2 where a=2; @@ -178,6 +181,7 @@ open(F, '>', $f) or die "open(>$f): $!"; syswrite F, $_ or die "syswrite($f): $!" EOF +--replace_column 7 # show create trigger tr2; --error ER_NO_SUCH_USER delete from t2 where a=2; |