mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +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:
@ -31,4 +31,25 @@ SELECT * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
delete from t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
a
|
||||
3
|
||||
4
|
||||
drop table t1;
|
||||
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;
|
||||
a
|
||||
1
|
||||
2
|
||||
delete from t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
a
|
||||
3
|
||||
4
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user