1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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

@ -2450,3 +2450,41 @@ DROP TABLE t1;
#
# End of 10.3 tests
#
#
# Test dropping orphan .trn file
#
create table t1 (a int);
create trigger t1_trg before insert on t1 for each row
begin
if isnull(new.a) then
set new.a:= 1000;
end if;
end|
insert into t1 values (null);
select * from t1;
a
1000
drop table t1;
drop trigger t1_trg;
Warnings:
Error 1146 Table 'test.t1' doesn't exist
Warning 4181 Dropped orphan trigger 't1_trg', originally created for table: 't1'
create table t1 (a int);
drop trigger t1_trg;
Warnings:
Warning 4181 Dropped orphan trigger 't1_trg', originally created for table: 't1'
create trigger t1_trg_2 before insert on t1 for each row
begin
if isnull(new.a) then
set new.a:= 1000;
end if;
end|
drop trigger t1_trg;
Warnings:
Error 1360 Trigger does not exist
Warning 4181 Dropped orphan trigger 't1_trg', originally created for table: 't1'
drop trigger t1_trg_2;
drop table t1;
#
# End of 10.6 tests
#