summaryrefslogtreecommitdiff
path: root/mysql-test/r/trigger.result
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2016-10-02 15:35:08 +0300
committerMonty <monty@mariadb.org>2016-10-05 01:11:07 +0300
commit8be53a389c8eebed337057fa366b7c4506ba16b1 (patch)
treeabd36c95a598f1d6e5537e94fd7de034715ce299 /mysql-test/r/trigger.result
parent0bae1957dd124f8382ae6af1de0e2168fc200bfb (diff)
downloadmariadb-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/r/trigger.result')
-rw-r--r--mysql-test/r/trigger.result57
1 files changed, 55 insertions, 2 deletions
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 19a8d53a428..2ae70730c3a 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -303,7 +303,7 @@ create trigger trg before insert on t1 for each row set @a:=1;
create trigger trg after insert on t1 for each row set @a:=1;
ERROR HY000: Trigger already exists
create trigger trg2 before insert on t1 for each row set @a:=1;
-ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
+drop trigger trg2;
create trigger trg before insert on t3 for each row set @a:=1;
ERROR HY000: Trigger already exists
create trigger trg2 before insert on t3 for each row set @a:=1;
@@ -1988,8 +1988,8 @@ create trigger t1_bi before insert on t1 for each row begin end;
create trigger t1_bi before insert on t1 for each row begin end;
ERROR HY000: Trigger already exists
create trigger t1_bi2 before insert on t1 for each row begin end;
-ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
drop trigger t1_bi;
+drop trigger t1_bi2;
drop trigger t1_bi;
ERROR HY000: Trigger does not exist
lock tables t1 read;
@@ -2123,6 +2123,7 @@ CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1
# Used to crash
SHOW TRIGGERS IN db1;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+trg1 INSERT t2 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERTINTOt1 VALUES (1) BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci
INSERT INTO t2 VALUES (1);
ERROR 42000: Trigger 'trg1' has an error in its body: 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VALUES (1)' at line 1'
SELECT * FROM t1;
@@ -2298,6 +2299,8 @@ SET optimizer_switch=@save_optimizer_switch;
DROP TRIGGER tr;
DROP TABLE t1, t2;
End of 5.3 tests.
+set time_zone="+00:00";
+SET TIMESTAMP=UNIX_TIMESTAMP('2001-01-01 10:20:30');
SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
CREATE TABLE t1 (c CHAR(1) NOT NULL);
CREATE TRIGGER t1_bi
@@ -2311,5 +2314,55 @@ END;
SET @@session.sql_mode = default;
INSERT INTO t1 VALUES ('a');
ERROR 22001: Data too long for column 'c' at row 1
+show create trigger t1_bi;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi
+BEFORE INSERT
+ON t1
+FOR EACH ROW
+BEGIN
+SET NEW.c = 'www';
+END latin1 latin1_swedish_ci latin1_swedish_ci 2001-01-01 10:20:30.00
DROP TRIGGER t1_bi;
DROP TABLE t1;
+SET TIMESTAMP=DEFAULT;
+set time_zone= @@global.time_zone;
+create table t1 (i int);
+create trigger tr1 after insert on t1 for each row set @a=@a+1;
+create trigger tr2 after insert on t1 for each row set @a=@a+1;
+create trigger tr3 after insert on t1 for each row set @a=@a+1;
+flush status;
+show status like 'Executed_triggers';
+Variable_name Value
+Executed_triggers 0
+set @a=0;
+insert into t1 values (1);
+show status like 'Executed_triggers';
+Variable_name Value
+Executed_triggers 3
+select @a;
+@a
+3
+drop table t1;
+create table t1 (i int);
+set time_zone="+0:00";
+SET TIMESTAMP=UNIX_TIMESTAMP('2016-01-01 10:10:10.33');
+select now(2);
+now(2)
+2016-01-01 10:10:10.33
+create or replace trigger tr1 after insert on t1 for each row set @a=@a+1;
+SET TIMESTAMP=UNIX_TIMESTAMP('2016-01-01 10:10:10.99');
+select now(2);
+now(2)
+2016-01-01 10:10:10.99
+create or replace trigger tr2 after insert on t1 for each row set @a=@a+1;
+select now(2);
+now(2)
+2016-01-01 10:10:10.99
+select trigger_name, action_order, created from information_schema.triggers
+where event_object_table = 't1' and trigger_schema='test';
+trigger_name action_order created
+tr1 1 2016-01-01 10:10:10.33
+tr2 2 2016-01-01 10:10:10.99
+drop table t1;
+set time_zone= @@global.time_zone;