mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fix for BUG#5033 "When using temporary tables truncate does NOT reset the auto_increment counter"
(ok'd by CTO to fix it in 4.0). Fix to make mysql-test-run work with all Valgrind versions. mysql-test/mysql-test-run.sh: fixing mysql-test-run.sh so that it works indifferently with Valgrind 1.x, 2.x (versions <= 2.0.0 refuse --tool option; versions >=2.1.2 require it; 2.1.0 accepts it). I hope the shell code is portable enough; anyway Valgrind only runs on Linux... I tested it with 2.0.0, 2.1.0, 2.1.2. mysql-test/r/truncate.result: result update mysql-test/t/truncate.test: testing if TRUNCATE resets autoinc counter for temp tables (BUG#5033); testing difference with DELETE FROM. sql/sql_delete.cc: in mysql_truncate(), always reset the autoinc counter, as manual says (even if it's a temp table, which was BUG#5033).
This commit is contained in:
@@ -23,7 +23,7 @@ drop table t1;
|
||||
truncate non_existing_table;
|
||||
|
||||
#
|
||||
# test autoincrement with TRUNCATE
|
||||
# test autoincrement with TRUNCATE; verifying difference with DELETE
|
||||
#
|
||||
|
||||
create table t1 (a integer auto_increment primary key);
|
||||
@@ -31,5 +31,19 @@ insert into t1 (a) values (NULL),(NULL);
|
||||
truncate table t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
delete from t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
drop table t1;
|
||||
|
||||
# Verifying that temp tables are handled the same way
|
||||
|
||||
create temporary table t1 (a integer auto_increment primary key);
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
truncate table t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
delete from t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
drop table t1;
|
||||
|
||||
Reference in New Issue
Block a user