summaryrefslogtreecommitdiff
path: root/mysql-test/r/trigger-trans.result
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/r/trigger-trans.result
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/r/trigger-trans.result')
-rw-r--r--mysql-test/r/trigger-trans.result27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/r/trigger-trans.result b/mysql-test/r/trigger-trans.result
index 9e0f1e2c351..29df8cbe06d 100644
--- a/mysql-test/r/trigger-trans.result
+++ b/mysql-test/r/trigger-trans.result
@@ -161,3 +161,30 @@ SELECT @a, @b;
1 1
DROP TABLE t2, t1;
End of 5.0 tests
+BUG#31612
+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;
+b val
+1 a
+2 b
+3 c
+4 d
+5 e
+6 f
+7 g
+8 a
+9 b
+10 c
+11 d
+12 e
+13 f
+14 g