mariadb/mysql-test/r/truncate.result
unknown e9c25d9336 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).
2004-08-23 16:15:57 +02:00

55 lines
1.1 KiB
Text

drop table if exists t1;
create table t1 (a integer, b integer,c1 CHAR(10));
insert into t1 (a) values (1),(2);
truncate table t1;
select count(*) from t1;
count(*)
0
insert into t1 values(1,2,"test");
select count(*) from t1;
count(*)
1
delete from t1;
select * from t1;
a b c1
drop table t1;
select count(*) from t1;
Table 'test.t1' doesn't exist
create temporary table t1 (n int);
insert into t1 values (1),(2),(3);
truncate table t1;
select * from t1;
n
drop table t1;
truncate non_existing_table;
Table 'test.non_existing_table' doesn't exist
create 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;
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;