summaryrefslogtreecommitdiff
path: root/mysql-test/t/trigger-trans.test
diff options
context:
space:
mode:
authorGuilhem Bichot <guilhem@mysql.com>2008-10-06 16:06:59 +0200
committerGuilhem Bichot <guilhem@mysql.com>2008-10-06 16:06:59 +0200
commitf8670e2c53dbd38fab2b5fd4c28025fb0f48a9ed (patch)
tree8b322cd1624911449002f4a3749fbc58181d2648 /mysql-test/t/trigger-trans.test
parent0b097b777768f6a01d02411f7b78e4fce9e55a45 (diff)
downloadmariadb-git-f8670e2c53dbd38fab2b5fd4c28025fb0f48a9ed.tar.gz
Fix for BUG#31612
"Trigger fired multiple times leads to gaps in auto_increment sequence". The bug was that if a trigger fired multiple times inside a top statement (for example top-statement is a multi-row INSERT, and trigger is ON INSERT), and that trigger inserted into an auto_increment column, then gaps could be observed in the auto_increment sequence, even if there were no other users of the database (no concurrency). It was wrong usage of THD::auto_inc_intervals_in_cur_stmt_for_binlog. Note that the fix changes "class handler", I'll tell the Storage Engine API team.
Diffstat (limited to 'mysql-test/t/trigger-trans.test')
-rw-r--r--mysql-test/t/trigger-trans.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/t/trigger-trans.test b/mysql-test/t/trigger-trans.test
index 5db5b982773..ae223b2666e 100644
--- a/mysql-test/t/trigger-trans.test
+++ b/mysql-test/t/trigger-trans.test
@@ -162,3 +162,16 @@ DROP TABLE t2, t1;
--echo End of 5.0 tests
+
+--echo BUG#31612
+--echo Trigger fired multiple times leads to gaps in auto_increment sequence
+create table t1 (a int, val char(1)) engine=InnoDB;
+create table t2 (b int auto_increment primary key,
+ val char(1)) engine=InnoDB;
+create trigger t1_after_insert after
+ insert on t1 for each row insert into t2 set val=NEW.val;
+insert into t1 values ( 123, 'a'), ( 123, 'b'), ( 123, 'c'),
+ (123, 'd'), (123, 'e'), (123, 'f'), (123, 'g');
+insert into t1 values ( 654, 'a'), ( 654, 'b'), ( 654, 'c'),
+ (654, 'd'), (654, 'e'), (654, 'f'), (654, 'g');
+select * from t2 order by b;