1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Ensure that one can drop a trigger with an orphan .TRN file

Before this fix, one would get a 'Trigger ... already exists' when trying
to create a trigger matching the original name and 'Trigger ... does not
exists" when trying to drop it.

Fixes a reported bug in MDEV-25180 Atomic ALTER TABLE

MDEV-25517 Atomic DDL: Assertion `query_arg' in THD::binlog_query
upon DROP TRIGGER

The bug was that the stmt_query variable was not populated
with the query in case of DROP TRIGGER of an orphan trigger
(.TRN file exists & table exists, but the trigger was not in
table->triggers).
This commit is contained in:
Monty
2021-03-21 17:47:56 +02:00
committed by Sergei Golubchik
parent ffe7f19fa6
commit c844a76b0a
6 changed files with 195 additions and 16 deletions

View File

@@ -22,3 +22,17 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER tr3_bi BEFORE INSERT ON t1 FOR EACH ROW precedes tr4_bi INSERT INTO t2 (a) VALUES (NEW.a + 400)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
#
# MDEV-25517 Atomic DDL: Assertion `query_arg' in THD::binlog_query
# upon DROP TRIGGER
#
CREATE TABLE t1 (a INT);
CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW SET @x = 1;
connect con1,localhost,root,,test;
DROP TRIGGER trg;
connection default;
DROP TRIGGER trg;
connection con1;
disconnect con1;
connection default;
DROP TABLE t1;