diff --git a/mysql-test/suite/sql_sequence/temporary.result b/mysql-test/suite/sql_sequence/temporary.result index 69463667210..b5c70fd3a50 100644 --- a/mysql-test/suite/sql_sequence/temporary.result +++ b/mysql-test/suite/sql_sequence/temporary.result @@ -17,3 +17,27 @@ drop temporary sequence s1; CREATE TEMPORARY SEQUENCE s1 ENGINE=InnoDB; INSERT INTO s1 VALUES (1, 1, 1000, 1, 1, 1, 1, 0); DROP TEMPORARY SEQUENCE s1; +# +# MDEV-13007 ALTER .. ENGINE on temporary sequence may go wrong +# +create temporary sequence s1 engine=aria; +alter table s1 engine myisam; +select nextval(s1); +nextval(s1) +1 +drop temporary sequence s1; +create temporary sequence s1 engine=innodb; +alter table s1 engine myisam; +select nextval(s1); +nextval(s1) +1 +drop temporary sequence s1; +create temporary sequence s1; +alter table s1 engine innodb; +select nextval(s1); +nextval(s1) +1 +select nextval(s1); +nextval(s1) +2 +drop temporary sequence s1; diff --git a/mysql-test/suite/sql_sequence/temporary.test b/mysql-test/suite/sql_sequence/temporary.test index 4943ed66ea4..aeacf6e9497 100644 --- a/mysql-test/suite/sql_sequence/temporary.test +++ b/mysql-test/suite/sql_sequence/temporary.test @@ -23,3 +23,21 @@ drop temporary sequence s1; CREATE TEMPORARY SEQUENCE s1 ENGINE=InnoDB; INSERT INTO s1 VALUES (1, 1, 1000, 1, 1, 1, 1, 0); DROP TEMPORARY SEQUENCE s1; + +--echo # +--echo # MDEV-13007 ALTER .. ENGINE on temporary sequence may go wrong +--echo # + +create temporary sequence s1 engine=aria; +alter table s1 engine myisam; +select nextval(s1); +drop temporary sequence s1; +create temporary sequence s1 engine=innodb; +alter table s1 engine myisam; +select nextval(s1); +drop temporary sequence s1; +create temporary sequence s1; +alter table s1 engine innodb; +select nextval(s1); +select nextval(s1); +drop temporary sequence s1;