Bug #1261 AutoIncrement not reset when deleting all records

Submitted: 12 Sep 2003 7:56 Modified: 15 Sep 2003 9:09
Reporter: Martin Bartelds Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:3.23.55 OS:FreeBSD (FreeBSD)
Assigned to: CPU Architecture:Any

[12 Sep 2003 7:56] Martin Bartelds
Description:
I'm not sure if this problem belongs in the category "MyISAM Table Handler".

Java ODBC interface from <java.sql>
When a "DELETE FROM <db_name>" is done, the records are removed but the Auto_Increment value is not reset to 0 or 1.
The query is entered using the java "Statement" class, function executeUpdate();

My application suffers from this problem after upgrading MySql from a previous version, I'm not sure about the original MySQL release.

How to repeat:
Execute the DELETE instruction.
[15 Sep 2003 9:09] Indrek Siitan
This is a documented change. If you want to reset the auto-increment
counter, you have to use "TRUNCATE TABLE <tablename>" instead of 
DELETE FROM.
[10 Mar 2005 17:06] [ name withheld ]
But doesn't this require a restart of mysql?

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.