mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -486,8 +486,8 @@ create trigger trg1_4 before UPDATE on t1 for each row
|
||||
set new.f1 = 'trig 1_4-yes';
|
||||
show triggers;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
connection no_privs;
|
||||
select current_user;
|
||||
current_user
|
||||
|
@ -332,11 +332,10 @@ Create trigger trg5_1 BEFORE INSERT
|
||||
on tb3 for each row set new.f122='Trigger1 3.5.7.5/6';
|
||||
Create trigger trg5_2 BEFORE INSERT
|
||||
on tb3 for each row set new.f122='Trigger2 3.5.7.5';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.5/6';
|
||||
f121 f122
|
||||
Test 3.5.7.5/6 Trigger1 3.5.7.5/6
|
||||
Test 3.5.7.5/6 Trigger2 3.5.7.5
|
||||
update tb3 set f122='Update 3.5.7.6' where f121= 'Test 3.5.7.5/6';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.5/6';
|
||||
f121 f122
|
||||
@ -352,7 +351,6 @@ Create trigger trg6_1 AFTER INSERT
|
||||
on tb3 for each row set @test_var='Trigger1 3.5.7.7/8';
|
||||
Create trigger trg6_2 AFTER INSERT
|
||||
on tb3 for each row set @test_var='Trigger2 3.5.7.7';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
Before trig 3.5.7.7
|
||||
@ -362,14 +360,14 @@ f121 f122
|
||||
Test 3.5.7.7/8 Insert 3.5.7.7
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger1 3.5.7.7/8
|
||||
Trigger2 3.5.7.7
|
||||
update tb3 set f122='Update 3.5.7.8' where f121= 'Test 3.5.7.7/8';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.7/8';
|
||||
f121 f122
|
||||
Test 3.5.7.7/8 Update 3.5.7.8
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger1 3.5.7.7/8
|
||||
Trigger2 3.5.7.7
|
||||
drop trigger trg6_1;
|
||||
drop trigger trg6_2;
|
||||
delete from tb3 where f121='Test 3.5.7.7/8';
|
||||
@ -380,7 +378,6 @@ Create trigger trg7_1 BEFORE UPDATE
|
||||
on tb3 for each row set new.f122='Trigger1 3.5.7.9/10';
|
||||
Create trigger trg7_2 BEFORE UPDATE
|
||||
on tb3 for each row set new.f122='Trigger2 3.5.7.9';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.9/10';
|
||||
f121 f122
|
||||
@ -388,7 +385,7 @@ Test 3.5.7.9/10 Insert 3.5.7.9
|
||||
update tb3 set f122='update 3.5.7.10' where f121='Test 3.5.7.9/10';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.9/10';
|
||||
f121 f122
|
||||
Test 3.5.7.9/10 Trigger1 3.5.7.9/10
|
||||
Test 3.5.7.9/10 Trigger2 3.5.7.9
|
||||
drop trigger trg7_1;
|
||||
drop trigger trg7_2;
|
||||
delete from tb3 where f121='Test 3.5.7.9/10';
|
||||
@ -400,7 +397,6 @@ Create trigger trg8_1 AFTER UPDATE
|
||||
on tb3 for each row set @test_var='Trigger 3.5.7.11/12';
|
||||
Create trigger trg8_2 AFTER UPDATE
|
||||
on tb3 for each row set @test_var='Trigger2 3.5.7.11';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
Before trig 3.5.7.11
|
||||
@ -417,7 +413,7 @@ f121 f122
|
||||
Test 3.5.7.11/12 update 3.5.7.12
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger 3.5.7.11/12
|
||||
Trigger2 3.5.7.11
|
||||
delete from tb3 where f121='Test 3.5.7.11/12';
|
||||
drop trigger trg8_1;
|
||||
drop trigger trg8_2;
|
||||
@ -430,7 +426,6 @@ Create trigger trg9_1 BEFORE DELETE
|
||||
on tb3 for each row set @test_var=@test_var+1;
|
||||
Create trigger trg9_2 BEFORE DELETE
|
||||
on tb3 for each row set @test_var=@test_var+10;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
1
|
||||
@ -446,11 +441,11 @@ Select f121,f122 from tb3 where f121='Test 3.5.7.13/14';
|
||||
f121 f122
|
||||
select @test_var;
|
||||
@test_var
|
||||
2
|
||||
12
|
||||
delete from tb3 where f121='Test 3.5.7.13/14';
|
||||
select @test_var;
|
||||
@test_var
|
||||
2
|
||||
12
|
||||
drop trigger trg9_1;
|
||||
drop trigger trg9_2;
|
||||
delete from tb3 where f121='Test 3.5.7.13/14';
|
||||
@ -462,7 +457,6 @@ Create trigger trg_3_406010_1 AFTER DELETE
|
||||
on tb3 for each row set @test_var=@test_var+5;
|
||||
Create trigger trg_3_406010_2 AFTER DELETE
|
||||
on tb3 for each row set @test_var=@test_var+50;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Create trigger trg_3_406010_1 AFTER INSERT
|
||||
on tb3 for each row set @test_var=@test_var+1;
|
||||
ERROR HY000: Trigger already exists
|
||||
@ -481,11 +475,11 @@ Select f121,f122 from tb3 where f121='Test 3.5.7.15/16';
|
||||
f121 f122
|
||||
select @test_var;
|
||||
@test_var
|
||||
6
|
||||
56
|
||||
delete from tb3 where f121='Test 3.5.7.15/16';
|
||||
select @test_var;
|
||||
@test_var
|
||||
6
|
||||
56
|
||||
drop trigger trg_3_406010_1;
|
||||
drop trigger trg_3_406010_2;
|
||||
delete from tb3 where f121='Test 3.5.7.15/16';
|
||||
|
@ -417,7 +417,7 @@ def information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294
|
||||
def information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL NULL utf8 utf8_general_ci varchar(6) select
|
||||
def information_schema TRIGGERS CHARACTER_SET_CLIENT 20 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select
|
||||
def information_schema TRIGGERS COLLATION_CONNECTION 21 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select
|
||||
def information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select
|
||||
def information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL 2 NULL NULL datetime(2) select
|
||||
def information_schema TRIGGERS DATABASE_COLLATION 22 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select
|
||||
def information_schema TRIGGERS DEFINER 19 NO varchar 189 567 NULL NULL NULL utf8 utf8_general_ci varchar(189) select
|
||||
def information_schema TRIGGERS EVENT_MANIPULATION 4 NO varchar 6 18 NULL NULL NULL utf8 utf8_general_ci varchar(6) select
|
||||
@ -950,7 +950,7 @@ NULL information_schema TRIGGERS ACTION_ORDER bigint NULL NULL NULL NULL bigint(
|
||||
3.0000 information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW varchar 3 9 utf8 utf8_general_ci varchar(3)
|
||||
3.0000 information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW varchar 3 9 utf8 utf8_general_ci varchar(3)
|
||||
NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime
|
||||
NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime(2)
|
||||
3.0000 information_schema TRIGGERS SQL_MODE varchar 8192 24576 utf8 utf8_general_ci varchar(8192)
|
||||
3.0000 information_schema TRIGGERS DEFINER varchar 189 567 utf8 utf8_general_ci varchar(189)
|
||||
3.0000 information_schema TRIGGERS CHARACTER_SET_CLIENT varchar 32 96 utf8 utf8_general_ci varchar(32)
|
||||
|
@ -417,7 +417,7 @@ def information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294
|
||||
def information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL NULL utf8 utf8_general_ci varchar(6)
|
||||
def information_schema TRIGGERS CHARACTER_SET_CLIENT 20 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32)
|
||||
def information_schema TRIGGERS COLLATION_CONNECTION 21 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32)
|
||||
def information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime
|
||||
def information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL 2 NULL NULL datetime(2)
|
||||
def information_schema TRIGGERS DATABASE_COLLATION 22 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32)
|
||||
def information_schema TRIGGERS DEFINER 19 NO varchar 189 567 NULL NULL NULL utf8 utf8_general_ci varchar(189)
|
||||
def information_schema TRIGGERS EVENT_MANIPULATION 4 NO varchar 6 18 NULL NULL NULL utf8 utf8_general_ci varchar(6)
|
||||
@ -950,7 +950,7 @@ NULL information_schema TRIGGERS ACTION_ORDER bigint NULL NULL NULL NULL bigint(
|
||||
3.0000 information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW varchar 3 9 utf8 utf8_general_ci varchar(3)
|
||||
3.0000 information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW varchar 3 9 utf8 utf8_general_ci varchar(3)
|
||||
NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime
|
||||
NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime(2)
|
||||
3.0000 information_schema TRIGGERS SQL_MODE varchar 8192 24576 utf8 utf8_general_ci varchar(8192)
|
||||
3.0000 information_schema TRIGGERS DEFINER varchar 189 567 utf8 utf8_general_ci varchar(189)
|
||||
3.0000 information_schema TRIGGERS CHARACTER_SET_CLIENT varchar 32 96 utf8 utf8_general_ci varchar(32)
|
||||
|
@ -45,7 +45,7 @@ ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL
|
||||
ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL
|
||||
ACTION_REFERENCE_OLD_ROW varchar(3) NO
|
||||
ACTION_REFERENCE_NEW_ROW varchar(3) NO
|
||||
CREATED datetime YES NULL
|
||||
CREATED datetime(2) YES NULL
|
||||
SQL_MODE varchar(8192) NO
|
||||
DEFINER varchar(189) NO
|
||||
CHARACTER_SET_CLIENT varchar(32) NO
|
||||
@ -70,7 +70,7 @@ TRIGGERS CREATE TEMPORARY TABLE `TRIGGERS` (
|
||||
`ACTION_REFERENCE_NEW_TABLE` varchar(64) DEFAULT NULL,
|
||||
`ACTION_REFERENCE_OLD_ROW` varchar(3) NOT NULL DEFAULT '',
|
||||
`ACTION_REFERENCE_NEW_ROW` varchar(3) NOT NULL DEFAULT '',
|
||||
`CREATED` datetime DEFAULT NULL,
|
||||
`CREATED` datetime(2) DEFAULT NULL,
|
||||
`SQL_MODE` varchar(8192) NOT NULL DEFAULT '',
|
||||
`DEFINER` varchar(189) NOT NULL DEFAULT '',
|
||||
`CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '',
|
||||
@ -95,7 +95,7 @@ ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL
|
||||
ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL
|
||||
ACTION_REFERENCE_OLD_ROW varchar(3) NO
|
||||
ACTION_REFERENCE_NEW_ROW varchar(3) NO
|
||||
CREATED datetime YES NULL
|
||||
CREATED datetime(2) YES NULL
|
||||
SQL_MODE varchar(8192) NO
|
||||
DEFINER varchar(189) NO
|
||||
CHARACTER_SET_CLIENT varchar(32) NO
|
||||
@ -106,8 +106,8 @@ WHERE trigger_catalog IS NOT NULL OR event_object_catalog IS NOT NULL
|
||||
OR action_condition IS NOT NULL OR action_reference_old_table IS NOT NULL
|
||||
OR action_reference_new_table IS NOT NULL;
|
||||
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
|
||||
def mtr gs_insert INSERT def mtr global_suppressions 0 NULL BEGIN DECLARE dummy INT; SELECT "" REGEXP NEW.pattern INTO dummy; END ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
def mtr ts_insert INSERT def mtr test_suppressions 0 NULL BEGIN DECLARE dummy INT; SELECT "" REGEXP NEW.pattern INTO dummy; END ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
def mtr gs_insert INSERT def mtr global_suppressions 1 NULL BEGIN DECLARE dummy INT; SELECT "" REGEXP NEW.pattern INTO dummy; END ROW BEFORE NULL NULL OLD NEW # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
def mtr ts_insert INSERT def mtr test_suppressions 1 NULL BEGIN DECLARE dummy INT; SELECT "" REGEXP NEW.pattern INTO dummy; END ROW BEFORE NULL NULL OLD NEW # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
##################################################################################
|
||||
# Testcase 3.2.18.2 + 3.2.18.3: INFORMATION_SCHEMA.TRIGGERS accessible information
|
||||
##################################################################################
|
||||
@ -136,10 +136,10 @@ GRANT SELECT ON db_datadict.t1 TO 'testuser3'@'localhost';
|
||||
SELECT * FROM information_schema.triggers
|
||||
WHERE trigger_name = 'trg1';
|
||||
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
|
||||
def db_datadict trg1 INSERT def db_datadict t1 0 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
def db_datadict trg1 INSERT def db_datadict t1 1 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW # testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW TRIGGERS FROM db_datadict;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE # testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
connect testuser2, localhost, testuser2, , db_datadict;
|
||||
SHOW GRANTS FOR 'testuser2'@'localhost';
|
||||
Grants for testuser2@localhost
|
||||
@ -160,10 +160,10 @@ GRANT SELECT ON `db_datadict`.`t1` TO 'testuser3'@'localhost'
|
||||
SELECT * FROM information_schema.triggers
|
||||
WHERE trigger_name = 'trg1';
|
||||
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
|
||||
def db_datadict trg1 INSERT def db_datadict t1 0 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
def db_datadict trg1 INSERT def db_datadict t1 1 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW # testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW TRIGGERS FROM db_datadict;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE # testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
connect testuser4, localhost, testuser4, , test;
|
||||
SHOW GRANTS FOR 'testuser4'@'localhost';
|
||||
Grants for testuser4@localhost
|
||||
@ -176,10 +176,10 @@ ERROR 42000: SELECT command denied to user 'testuser4'@'localhost' for table 't1
|
||||
SELECT * FROM information_schema.triggers
|
||||
WHERE trigger_name = 'trg1';
|
||||
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
|
||||
def db_datadict trg1 INSERT def db_datadict t1 0 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
def db_datadict trg1 INSERT def db_datadict t1 1 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW # testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW TRIGGERS FROM db_datadict;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE # testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
connection default;
|
||||
disconnect testuser1;
|
||||
disconnect testuser2;
|
||||
@ -188,10 +188,10 @@ disconnect testuser4;
|
||||
SELECT * FROM information_schema.triggers
|
||||
WHERE trigger_name = 'trg1';
|
||||
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
|
||||
def db_datadict trg1 INSERT def db_datadict t1 0 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
def db_datadict trg1 INSERT def db_datadict t1 1 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW # testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW TRIGGERS FROM db_datadict;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE # testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
|
@ -487,8 +487,8 @@ create trigger trg1_4 before UPDATE on t1 for each row
|
||||
set new.f1 = 'trig 1_4-yes';
|
||||
show triggers;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
connection no_privs;
|
||||
select current_user;
|
||||
current_user
|
||||
|
@ -332,11 +332,10 @@ Create trigger trg5_1 BEFORE INSERT
|
||||
on tb3 for each row set new.f122='Trigger1 3.5.7.5/6';
|
||||
Create trigger trg5_2 BEFORE INSERT
|
||||
on tb3 for each row set new.f122='Trigger2 3.5.7.5';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.5/6';
|
||||
f121 f122
|
||||
Test 3.5.7.5/6 Trigger1 3.5.7.5/6
|
||||
Test 3.5.7.5/6 Trigger2 3.5.7.5
|
||||
update tb3 set f122='Update 3.5.7.6' where f121= 'Test 3.5.7.5/6';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.5/6';
|
||||
f121 f122
|
||||
@ -352,7 +351,6 @@ Create trigger trg6_1 AFTER INSERT
|
||||
on tb3 for each row set @test_var='Trigger1 3.5.7.7/8';
|
||||
Create trigger trg6_2 AFTER INSERT
|
||||
on tb3 for each row set @test_var='Trigger2 3.5.7.7';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
Before trig 3.5.7.7
|
||||
@ -362,14 +360,14 @@ f121 f122
|
||||
Test 3.5.7.7/8 Insert 3.5.7.7
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger1 3.5.7.7/8
|
||||
Trigger2 3.5.7.7
|
||||
update tb3 set f122='Update 3.5.7.8' where f121= 'Test 3.5.7.7/8';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.7/8';
|
||||
f121 f122
|
||||
Test 3.5.7.7/8 Update 3.5.7.8
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger1 3.5.7.7/8
|
||||
Trigger2 3.5.7.7
|
||||
drop trigger trg6_1;
|
||||
drop trigger trg6_2;
|
||||
delete from tb3 where f121='Test 3.5.7.7/8';
|
||||
@ -380,7 +378,6 @@ Create trigger trg7_1 BEFORE UPDATE
|
||||
on tb3 for each row set new.f122='Trigger1 3.5.7.9/10';
|
||||
Create trigger trg7_2 BEFORE UPDATE
|
||||
on tb3 for each row set new.f122='Trigger2 3.5.7.9';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.9/10';
|
||||
f121 f122
|
||||
@ -388,7 +385,7 @@ Test 3.5.7.9/10 Insert 3.5.7.9
|
||||
update tb3 set f122='update 3.5.7.10' where f121='Test 3.5.7.9/10';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.9/10';
|
||||
f121 f122
|
||||
Test 3.5.7.9/10 Trigger1 3.5.7.9/10
|
||||
Test 3.5.7.9/10 Trigger2 3.5.7.9
|
||||
drop trigger trg7_1;
|
||||
drop trigger trg7_2;
|
||||
delete from tb3 where f121='Test 3.5.7.9/10';
|
||||
@ -400,7 +397,6 @@ Create trigger trg8_1 AFTER UPDATE
|
||||
on tb3 for each row set @test_var='Trigger 3.5.7.11/12';
|
||||
Create trigger trg8_2 AFTER UPDATE
|
||||
on tb3 for each row set @test_var='Trigger2 3.5.7.11';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
Before trig 3.5.7.11
|
||||
@ -417,7 +413,7 @@ f121 f122
|
||||
Test 3.5.7.11/12 update 3.5.7.12
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger 3.5.7.11/12
|
||||
Trigger2 3.5.7.11
|
||||
delete from tb3 where f121='Test 3.5.7.11/12';
|
||||
drop trigger trg8_1;
|
||||
drop trigger trg8_2;
|
||||
@ -430,7 +426,6 @@ Create trigger trg9_1 BEFORE DELETE
|
||||
on tb3 for each row set @test_var=@test_var+1;
|
||||
Create trigger trg9_2 BEFORE DELETE
|
||||
on tb3 for each row set @test_var=@test_var+10;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
1
|
||||
@ -446,11 +441,11 @@ Select f121,f122 from tb3 where f121='Test 3.5.7.13/14';
|
||||
f121 f122
|
||||
select @test_var;
|
||||
@test_var
|
||||
2
|
||||
12
|
||||
delete from tb3 where f121='Test 3.5.7.13/14';
|
||||
select @test_var;
|
||||
@test_var
|
||||
2
|
||||
12
|
||||
drop trigger trg9_1;
|
||||
drop trigger trg9_2;
|
||||
delete from tb3 where f121='Test 3.5.7.13/14';
|
||||
@ -462,7 +457,6 @@ Create trigger trg_3_406010_1 AFTER DELETE
|
||||
on tb3 for each row set @test_var=@test_var+5;
|
||||
Create trigger trg_3_406010_2 AFTER DELETE
|
||||
on tb3 for each row set @test_var=@test_var+50;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Create trigger trg_3_406010_1 AFTER INSERT
|
||||
on tb3 for each row set @test_var=@test_var+1;
|
||||
ERROR HY000: Trigger already exists
|
||||
@ -481,11 +475,11 @@ Select f121,f122 from tb3 where f121='Test 3.5.7.15/16';
|
||||
f121 f122
|
||||
select @test_var;
|
||||
@test_var
|
||||
6
|
||||
56
|
||||
delete from tb3 where f121='Test 3.5.7.15/16';
|
||||
select @test_var;
|
||||
@test_var
|
||||
6
|
||||
56
|
||||
drop trigger trg_3_406010_1;
|
||||
drop trigger trg_3_406010_2;
|
||||
delete from tb3 where f121='Test 3.5.7.15/16';
|
||||
|
@ -487,8 +487,8 @@ create trigger trg1_4 before UPDATE on t1 for each row
|
||||
set new.f1 = 'trig 1_4-yes';
|
||||
show triggers;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
connection no_privs;
|
||||
select current_user;
|
||||
current_user
|
||||
|
@ -332,11 +332,10 @@ Create trigger trg5_1 BEFORE INSERT
|
||||
on tb3 for each row set new.f122='Trigger1 3.5.7.5/6';
|
||||
Create trigger trg5_2 BEFORE INSERT
|
||||
on tb3 for each row set new.f122='Trigger2 3.5.7.5';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.5/6';
|
||||
f121 f122
|
||||
Test 3.5.7.5/6 Trigger1 3.5.7.5/6
|
||||
Test 3.5.7.5/6 Trigger2 3.5.7.5
|
||||
update tb3 set f122='Update 3.5.7.6' where f121= 'Test 3.5.7.5/6';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.5/6';
|
||||
f121 f122
|
||||
@ -352,7 +351,6 @@ Create trigger trg6_1 AFTER INSERT
|
||||
on tb3 for each row set @test_var='Trigger1 3.5.7.7/8';
|
||||
Create trigger trg6_2 AFTER INSERT
|
||||
on tb3 for each row set @test_var='Trigger2 3.5.7.7';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
Before trig 3.5.7.7
|
||||
@ -362,14 +360,14 @@ f121 f122
|
||||
Test 3.5.7.7/8 Insert 3.5.7.7
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger1 3.5.7.7/8
|
||||
Trigger2 3.5.7.7
|
||||
update tb3 set f122='Update 3.5.7.8' where f121= 'Test 3.5.7.7/8';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.7/8';
|
||||
f121 f122
|
||||
Test 3.5.7.7/8 Update 3.5.7.8
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger1 3.5.7.7/8
|
||||
Trigger2 3.5.7.7
|
||||
drop trigger trg6_1;
|
||||
drop trigger trg6_2;
|
||||
delete from tb3 where f121='Test 3.5.7.7/8';
|
||||
@ -380,7 +378,6 @@ Create trigger trg7_1 BEFORE UPDATE
|
||||
on tb3 for each row set new.f122='Trigger1 3.5.7.9/10';
|
||||
Create trigger trg7_2 BEFORE UPDATE
|
||||
on tb3 for each row set new.f122='Trigger2 3.5.7.9';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.9/10';
|
||||
f121 f122
|
||||
@ -388,7 +385,7 @@ Test 3.5.7.9/10 Insert 3.5.7.9
|
||||
update tb3 set f122='update 3.5.7.10' where f121='Test 3.5.7.9/10';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.9/10';
|
||||
f121 f122
|
||||
Test 3.5.7.9/10 Trigger1 3.5.7.9/10
|
||||
Test 3.5.7.9/10 Trigger2 3.5.7.9
|
||||
drop trigger trg7_1;
|
||||
drop trigger trg7_2;
|
||||
delete from tb3 where f121='Test 3.5.7.9/10';
|
||||
@ -400,7 +397,6 @@ Create trigger trg8_1 AFTER UPDATE
|
||||
on tb3 for each row set @test_var='Trigger 3.5.7.11/12';
|
||||
Create trigger trg8_2 AFTER UPDATE
|
||||
on tb3 for each row set @test_var='Trigger2 3.5.7.11';
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
Before trig 3.5.7.11
|
||||
@ -417,7 +413,7 @@ f121 f122
|
||||
Test 3.5.7.11/12 update 3.5.7.12
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger 3.5.7.11/12
|
||||
Trigger2 3.5.7.11
|
||||
delete from tb3 where f121='Test 3.5.7.11/12';
|
||||
drop trigger trg8_1;
|
||||
drop trigger trg8_2;
|
||||
@ -430,7 +426,6 @@ Create trigger trg9_1 BEFORE DELETE
|
||||
on tb3 for each row set @test_var=@test_var+1;
|
||||
Create trigger trg9_2 BEFORE DELETE
|
||||
on tb3 for each row set @test_var=@test_var+10;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
1
|
||||
@ -446,11 +441,11 @@ Select f121,f122 from tb3 where f121='Test 3.5.7.13/14';
|
||||
f121 f122
|
||||
select @test_var;
|
||||
@test_var
|
||||
2
|
||||
12
|
||||
delete from tb3 where f121='Test 3.5.7.13/14';
|
||||
select @test_var;
|
||||
@test_var
|
||||
2
|
||||
12
|
||||
drop trigger trg9_1;
|
||||
drop trigger trg9_2;
|
||||
delete from tb3 where f121='Test 3.5.7.13/14';
|
||||
@ -462,7 +457,6 @@ Create trigger trg_3_406010_1 AFTER DELETE
|
||||
on tb3 for each row set @test_var=@test_var+5;
|
||||
Create trigger trg_3_406010_2 AFTER DELETE
|
||||
on tb3 for each row set @test_var=@test_var+50;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Create trigger trg_3_406010_1 AFTER INSERT
|
||||
on tb3 for each row set @test_var=@test_var+1;
|
||||
ERROR HY000: Trigger already exists
|
||||
@ -481,11 +475,11 @@ Select f121,f122 from tb3 where f121='Test 3.5.7.15/16';
|
||||
f121 f122
|
||||
select @test_var;
|
||||
@test_var
|
||||
6
|
||||
56
|
||||
delete from tb3 where f121='Test 3.5.7.15/16';
|
||||
select @test_var;
|
||||
@test_var
|
||||
6
|
||||
56
|
||||
drop trigger trg_3_406010_1;
|
||||
drop trigger trg_3_406010_2;
|
||||
delete from tb3 where f121='Test 3.5.7.15/16';
|
||||
|
Reference in New Issue
Block a user