mirror of
https://github.com/MariaDB/server.git
synced 2025-02-09 23:24:11 +01:00
![Monty](/assets/img/avatar_default.png)
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).
51 lines
1.6 KiB
Text
51 lines
1.6 KiB
Text
--source include/not_embedded.inc
|
|
--source include/have_binlog_format_statement.inc
|
|
|
|
--disable_query_log
|
|
reset master; # get rid of previous tests binlog
|
|
--enable_query_log
|
|
|
|
--echo #
|
|
--echo # WL#3253: multiple triggers per table
|
|
--echo #
|
|
|
|
--echo # Testing that the FOLLOWS and PRECEDES clauses get logged
|
|
|
|
CREATE TABLE t1 (a INT, b INT);
|
|
CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 100);
|
|
CREATE TRIGGER tr4_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 300);
|
|
CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW FOLLOWS tr1_bi INSERT INTO t2 (a) VALUES (NEW.a + 200);
|
|
CREATE TRIGGER tr3_bi BEFORE INSERT ON t1 FOR EACH ROW precedes tr4_bi INSERT INTO t2 (a) VALUES (NEW.a + 400);
|
|
DROP TABLE t1;
|
|
|
|
|
|
--let $binlog_file = LAST
|
|
source include/show_binlog_events.inc;
|
|
|
|
--echo #
|
|
--echo # MDEV-25517 Atomic DDL: Assertion `query_arg' in THD::binlog_query
|
|
--echo # upon DROP TRIGGER
|
|
--echo #
|
|
|
|
# This test case is 'random' by design. For most cases the second DROP TRIGGER
|
|
# will generate a warning "Dropped orphan trigger...", but if there is a timing
|
|
# issue, we may get another error or warning later. This is ok as it enables
|
|
# us to have more code paths tested over time.
|
|
|
|
CREATE TABLE t1 (a INT);
|
|
CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW SET @x = 1;
|
|
--disable_warnings
|
|
--connect (con1,localhost,root,,test)
|
|
--send
|
|
DROP TRIGGER trg;
|
|
--connection default
|
|
--error 0,ER_TRG_DOES_NOT_EXIST
|
|
DROP TRIGGER trg;
|
|
# Cleanup
|
|
--connection con1
|
|
--error 0,ER_TRG_DOES_NOT_EXIST
|
|
--reap
|
|
--disconnect con1
|
|
--connection default
|
|
--enable_warnings
|
|
DROP TABLE t1;
|