diff options
Diffstat (limited to 'mysql-test/t/innodb.test')
-rw-r--r-- | mysql-test/t/innodb.test | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index bf094dd0e5d..18c27cee3ad 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1231,6 +1231,24 @@ SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t DROP TABLE t2; DROP TABLE t1; +# +# Bug#11816 - Truncate table doesn't work with temporary innodb tables +# This is not an innodb bug, but we test it using innodb. +# +create temporary table t1 (a int) engine=innodb; +insert into t1 values (4711); +truncate t1; +insert into t1 values (42); +select * from t1; +drop table t1; +# Show that it works with permanent tables too. +create table t1 (a int) engine=innodb; +insert into t1 values (4711); +truncate t1; +insert into t1 values (42); +select * from t1; +drop table t1; + # End of 4.1 tests # @@ -1405,3 +1423,31 @@ insert into t1 values ('aa','bb'),('aa','cc'); delete t1 from t1,t2 where f1=f3 and f4='cc'; select * from t1; drop table t1,t2; + +# +# Test that the slow TRUNCATE implementation resets autoincrement columns +# (bug #11946) +# + +CREATE TABLE t1 ( +id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) +) ENGINE=InnoDB; + +CREATE TABLE t2 ( +id INTEGER NOT NULL, +FOREIGN KEY (id) REFERENCES t1 (id) +) ENGINE=InnoDB; + +INSERT INTO t1 (id) VALUES (NULL); +SELECT * FROM t1; +TRUNCATE t1; +INSERT INTO t1 (id) VALUES (NULL); +SELECT * FROM t1; + +# continued from above; test that doing a slow TRUNCATE on a table with 0 +# rows resets autoincrement columns +DELETE FROM t1; +TRUNCATE t1; +INSERT INTO t1 (id) VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t2, t1; |