Bug #5033 When using temporary tables truncate does NOT reset the auto_increment counter
Submitted: 13 Aug 2004 14:19 Modified: 23 Aug 2004 16:26
Reporter: Adam Tylmad Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:4.0.20 OS:Microsoft Windows (w2k)
Assigned to: Guilhem Bichot CPU Architecture:Any

[13 Aug 2004 14:19] Adam Tylmad
Description:
When using temporary tables truncate does NOT reset the auto_increment counter

example:
create temporary table test (id int(4) not null auto_increment, content int(4), primary key (id));
insert into test (content) values (4711);
truncate test;
insert into test (content) values (42);
select * from test;
->
id ----------- content
2 ----------- 42

How to repeat:
create temporary table test (id int(4) not null auto_increment, content int(4), primary key (id));
insert into test (content) values (4711);
truncate test;
insert into test (content) values (42);
select * from test;

Suggested fix:
reset the auto_increment counter when running truncate...
[23 Aug 2004 16:26] Guilhem Bichot
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Hello,
Thank you for your bug report. It will be fixed in 4.0.21.
ChangeSet@1.1981.1.1, 2004-08-23 16:15:57+02:00, guilhem@mysql.com