1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%';
FLUSH PRIVILEGES;
DROP DATABASE IF EXISTS mysqltest_db1;
CREATE DATABASE mysqltest_db1;
CREATE USER mysqltest_dfn@localhost;
CREATE USER mysqltest_inv@localhost;
GRANT CREATE, TRIGGER ON mysqltest_db1.* TO mysqltest_dfn@localhost;
connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
connection wl2818_definer_con;
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
---> patching t1.TRG...
CREATE TRIGGER wl2818_trg2 AFTER INSERT ON t1
FOR EACH ROW
INSERT INTO t2 VALUES(CURRENT_USER());
Warnings:
Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger
SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
trigger_name definer
wl2818_trg1
wl2818_trg2 mysqltest_dfn@localhost
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
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 mysqltest_db1 wl2818_trg1 INSERT def mysqltest_db1 t1 1 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci
def mysqltest_db1 wl2818_trg2 INSERT def mysqltest_db1 t1 1 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_dfn@localhost latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER wl2818_trg1;
Warnings:
Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger
DROP TRIGGER wl2818_trg2;
disconnect wl2818_definer_con;
connection default;
use mysqltest_db1;
DROP TABLE t1;
DROP TABLE t2;
DROP USER mysqltest_dfn@localhost;
DROP USER mysqltest_inv@localhost;
DROP DATABASE mysqltest_db1;
USE test;
#
# Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
#
DROP TABLE IF EXISTS t1, t2, t3;
CREATE TABLE t1 ( a INT );
CREATE TABLE t2 ( a INT );
CREATE TABLE t3 ( a INT );
INSERT INTO t1 VALUES (1), (2), (3);
INSERT INTO t2 VALUES (1), (2), (3);
INSERT INTO t3 VALUES (1), (2), (3);
# We simulate importing a trigger from 5.0 by writing a .TRN file for
# each trigger plus a .TRG file the way MySQL 5.0 would have done it,
# with syntax allowed in 5.0 only.
#
# Note that in 5.0 the following lines are missing from t1.TRG:
#
# client_cs_names='latin1'
# connection_cl_names='latin1_swedish_ci'
# db_cl_names='latin1_swedish_ci'
FLUSH TABLE t1;
FLUSH TABLE t2;
# We will get parse errors for most DDL and DML statements when the table
# has broken triggers. The parse error refers to the first broken
# trigger.
CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
ERROR 42000: Trigger 'tr13' 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 'a USING t1 a' at line 1'
CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
ERROR 42000: Unknown trigger 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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
tr11 INSERT t1 DELETE FROM t3 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
tr12 INSERT t1 DELETE FROM t3 AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
tr15 UPDATE t1 CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a BEFORE # latin1 latin1_swedish_ci latin1_swedish_ci
tr13 DELETE t1 CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a BEFORE # latin1 latin1_swedish_ci latin1_swedish_ci
tr14 DELETE t1 DELETE FROM non_existing_table AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
INSERT INTO t1 VALUES (1);
ERROR 42000: Trigger 'tr13' 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 'a USING t1 a' at line 1'
INSERT INTO t2 VALUES (1);
ERROR 42000: Unknown trigger 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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
DELETE FROM t1;
ERROR 42000: Trigger 'tr13' 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 'a USING t1 a' at line 1'
UPDATE t1 SET a = 1 WHERE a = 1;
ERROR 42000: Trigger 'tr13' 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 'a USING t1 a' at line 1'
SELECT * FROM t1;
a
1
2
3
RENAME TABLE t1 TO t1_2;
ERROR 42000: Trigger 'tr13' 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 'a USING t1 a' at line 1'
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
tr11 INSERT t1 DELETE FROM t3 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
tr12 INSERT t1 DELETE FROM t3 AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
tr15 UPDATE t1 CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a BEFORE # latin1 latin1_swedish_ci latin1_swedish_ci
tr13 DELETE t1 CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a BEFORE # latin1 latin1_swedish_ci latin1_swedish_ci
tr14 DELETE t1 DELETE FROM non_existing_table AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER tr11;
Warnings:
Warning 1603 Triggers for table `test`.`t1` have no creation context
DROP TRIGGER tr12;
DROP TRIGGER tr13;
DROP TRIGGER tr14;
DROP TRIGGER tr15;
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
# Make sure there is no trigger file left.
# We write the same trigger files one more time to test DROP TABLE.
FLUSH TABLE t1;
FLUSH TABLE t2;
DROP TABLE t1;
Warnings:
Warning 1603 Triggers for table `test`.`t1` have no creation context
DROP TABLE t2;
Warnings:
Warning 1603 Triggers for table `test`.`t2` have no creation context
DROP TABLE t3;
# Make sure there is no trigger file left.
CREATE TABLE t1 ( a INT );
CREATE TABLE t2 ( a INT );
INSERT INTO t1 VALUES (1), (2), (3);
INSERT INTO t2 VALUES (1), (2), (3);
# We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
# and last trigger is broken.
# Next we try to execute SHOW CREATE TRIGGER command for broken trigger and then try to drop one.
FLUSH TABLE t1;
SHOW CREATE TRIGGER tr12;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
tr12 CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2 latin1 latin1_swedish_ci latin1_swedish_ci NULL
Warnings:
Warning 1603 Triggers for table `test`.`t1` have no creation context
SHOW CREATE TRIGGER tr11;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
tr11 CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a latin1 latin1_swedish_ci latin1_swedish_ci NULL
DROP TRIGGER tr12;
DROP TRIGGER tr11;
DROP TABLE t1;
DROP TABLE t2;
#
# MDEV-25659 trigger name is empty after upgrade to 10.4
#
# START: Total triggers 1, broken triggers 1, DROP TABLE
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
FLUSH TABLES;
DELETE FROM t1 WHERE a=1;
ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable'
INSERT INTO t1 VALUES (2);
ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable'
SET time_zone='+00:00';
SHOW TRIGGERS LIKE 't1';
Trigger tr1
Event DELETE
Table t1
Statement CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
IF unknown_variable
THEN
INSERT INTO t2 VALUES (OLD.a);
END IF;
END
Timing AFTER
Created 2022-01-13 08:23:06.47
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Definer
character_set_client utf8mb3
collation_connection utf8mb3_general_ci
Database Collation latin1_swedish_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1';
TRIGGER_CATALOG def
TRIGGER_SCHEMA test
TRIGGER_NAME tr1
EVENT_MANIPULATION DELETE
EVENT_OBJECT_CATALOG def
EVENT_OBJECT_SCHEMA test
EVENT_OBJECT_TABLE t1
ACTION_ORDER 1
ACTION_CONDITION NULL
ACTION_STATEMENT CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
IF unknown_variable
THEN
INSERT INTO t2 VALUES (OLD.a);
END IF;
END
ACTION_ORIENTATION ROW
ACTION_TIMING AFTER
ACTION_REFERENCE_OLD_TABLE NULL
ACTION_REFERENCE_NEW_TABLE NULL
ACTION_REFERENCE_OLD_ROW OLD
ACTION_REFERENCE_NEW_ROW NEW
CREATED 2022-01-13 08:23:06.47
SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
DEFINER
CHARACTER_SET_CLIENT utf8mb3
COLLATION_CONNECTION utf8mb3_general_ci
DATABASE_COLLATION latin1_swedish_ci
SET time_zone=DEFAULT;
# Listing trigger files
t1.TRG
tr1.TRN
# Listing trigger files done
DROP TABLE t1;
# Listing trigger files
# Listing trigger files done
# END: Total triggers 1, broken triggers 1, DROP TABLE
# START: Total triggers 1, broken triggers 1, DROP TRIGGER
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
FLUSH TABLES;
DELETE FROM t1 WHERE a=1;
ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable'
INSERT INTO t1 VALUES (2);
ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable'
SET time_zone='+00:00';
SHOW TRIGGERS LIKE 't1';
Trigger tr1
Event DELETE
Table t1
Statement CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
IF unknown_variable
THEN
INSERT INTO t2 VALUES (OLD.a);
END IF;
END
Timing AFTER
Created 2022-01-13 08:23:06.47
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Definer
character_set_client utf8mb3
collation_connection utf8mb3_general_ci
Database Collation latin1_swedish_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1';
TRIGGER_CATALOG def
TRIGGER_SCHEMA test
TRIGGER_NAME tr1
EVENT_MANIPULATION DELETE
EVENT_OBJECT_CATALOG def
EVENT_OBJECT_SCHEMA test
EVENT_OBJECT_TABLE t1
ACTION_ORDER 1
ACTION_CONDITION NULL
ACTION_STATEMENT CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
IF unknown_variable
THEN
INSERT INTO t2 VALUES (OLD.a);
END IF;
END
ACTION_ORIENTATION ROW
ACTION_TIMING AFTER
ACTION_REFERENCE_OLD_TABLE NULL
ACTION_REFERENCE_NEW_TABLE NULL
ACTION_REFERENCE_OLD_ROW OLD
ACTION_REFERENCE_NEW_ROW NEW
CREATED 2022-01-13 08:23:06.47
SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
DEFINER
CHARACTER_SET_CLIENT utf8mb3
COLLATION_CONNECTION utf8mb3_general_ci
DATABASE_COLLATION latin1_swedish_ci
SET time_zone=DEFAULT;
# Listing trigger files
t1.TRG
tr1.TRN
# Listing trigger files done
DROP TRIGGER tr1;
# Listing trigger files
# Listing trigger files done
DROP TABLE t1;
# END: Total triggers 1, broken triggers 1, DROP TRIGGER
# START: Total triggers 2, broken triggers 1, DROP TABLE
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
FLUSH TABLES;
DELETE FROM t1 WHERE a=1;
ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable'
INSERT INTO t1 VALUES (2);
ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable'
SET time_zone='+00:00';
SHOW TRIGGERS LIKE 't1';
Trigger tr2
Event INSERT
Table t1
Statement INSERT INTO t2 VALUES (NEW.a+100)
Timing AFTER
Created 2022-01-13 10:01:48.74
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Definer root@localhost
character_set_client utf8mb3
collation_connection utf8mb3_general_ci
Database Collation latin1_swedish_ci
Trigger tr1
Event DELETE
Table t1
Statement CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
IF unknown_variable
THEN
INSERT INTO t2 VALUES (OLD.a);
END IF;
END
Timing AFTER
Created 2022-01-13 10:01:48.73
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Definer
character_set_client utf8mb3
collation_connection utf8mb3_general_ci
Database Collation latin1_swedish_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1';
TRIGGER_CATALOG def
TRIGGER_SCHEMA test
TRIGGER_NAME tr1
EVENT_MANIPULATION DELETE
EVENT_OBJECT_CATALOG def
EVENT_OBJECT_SCHEMA test
EVENT_OBJECT_TABLE t1
ACTION_ORDER 1
ACTION_CONDITION NULL
ACTION_STATEMENT CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
IF unknown_variable
THEN
INSERT INTO t2 VALUES (OLD.a);
END IF;
END
ACTION_ORIENTATION ROW
ACTION_TIMING AFTER
ACTION_REFERENCE_OLD_TABLE NULL
ACTION_REFERENCE_NEW_TABLE NULL
ACTION_REFERENCE_OLD_ROW OLD
ACTION_REFERENCE_NEW_ROW NEW
CREATED 2022-01-13 10:01:48.73
SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
DEFINER
CHARACTER_SET_CLIENT utf8mb3
COLLATION_CONNECTION utf8mb3_general_ci
DATABASE_COLLATION latin1_swedish_ci
SET time_zone=DEFAULT;
# Listing trigger files
t1.TRG
tr1.TRN
tr2.TRN
# Listing trigger files done
DROP TABLE t1;
# Listing trigger files
# Listing trigger files done
# END: Total triggers 2, broken triggers 1, using DROP TABLE
# START: Total triggers 2, broken triggers 1, DROP TRIGGER
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
FLUSH TABLES;
DELETE FROM t1 WHERE a=1;
ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable'
INSERT INTO t1 VALUES (2);
ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable'
SET time_zone='+00:00';
SHOW TRIGGERS LIKE 't1';
Trigger tr2
Event INSERT
Table t1
Statement INSERT INTO t2 VALUES (NEW.a+100)
Timing AFTER
Created 2022-01-13 10:01:48.74
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Definer root@localhost
character_set_client utf8mb3
collation_connection utf8mb3_general_ci
Database Collation latin1_swedish_ci
Trigger tr1
Event DELETE
Table t1
Statement CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
IF unknown_variable
THEN
INSERT INTO t2 VALUES (OLD.a);
END IF;
END
Timing AFTER
Created 2022-01-13 10:01:48.73
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Definer
character_set_client utf8mb3
collation_connection utf8mb3_general_ci
Database Collation latin1_swedish_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1';
TRIGGER_CATALOG def
TRIGGER_SCHEMA test
TRIGGER_NAME tr1
EVENT_MANIPULATION DELETE
EVENT_OBJECT_CATALOG def
EVENT_OBJECT_SCHEMA test
EVENT_OBJECT_TABLE t1
ACTION_ORDER 1
ACTION_CONDITION NULL
ACTION_STATEMENT CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
IF unknown_variable
THEN
INSERT INTO t2 VALUES (OLD.a);
END IF;
END
ACTION_ORIENTATION ROW
ACTION_TIMING AFTER
ACTION_REFERENCE_OLD_TABLE NULL
ACTION_REFERENCE_NEW_TABLE NULL
ACTION_REFERENCE_OLD_ROW OLD
ACTION_REFERENCE_NEW_ROW NEW
CREATED 2022-01-13 10:01:48.73
SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
DEFINER
CHARACTER_SET_CLIENT utf8mb3
COLLATION_CONNECTION utf8mb3_general_ci
DATABASE_COLLATION latin1_swedish_ci
SET time_zone=DEFAULT;
# Listing trigger files
t1.TRG
tr1.TRN
tr2.TRN
# Listing trigger files done
DROP TRIGGER tr1;
# Listing trigger files
t1.TRG
tr2.TRN
# Listing trigger files done
INSERT INTO t1 VALUES (100);
ERROR 42S02: Table 'test.t2' doesn't exist
DROP TABLE t1;
# Listing trigger files
# Listing trigger files done
# END: Total triggers 2, broken triggers 1, using DROP TRIGGER
|