Incorrect AUTO_INCREMENT Value After Data Import Causing Duplicate Key Error(when AUTO_ID_CACHE=1) #56476
Labels
affects-6.5
affects-7.1
affects-7.5
affects-8.1
component/ddl
This issue is related to DDL of TiDB.
component/lightning
This issue is related to Lightning of TiDB.
severity/major
type/bug
The issue is confirmed as a bug.
Bug Report
Problem:
After importing data into a table, the AUTO_INCREMENT value is not updated to the correct value (max(id) + 1), leading to a “Duplicate entry” error on subsequent insertions.
1. Minimal reproduce step (Required)
AUTO_INCREMENT=5555
AUTO_ID_CACHE=1
CLUSTERED
tableThe system throws a duplicate key error:
2. What did you expect to see? (Required)
After importing data, the AUTO_INCREMENT value should automatically adjust to max(id) + 1 to avoid any duplicate key conflicts.
3. What did you see instead (Required)
The AUTO_INCREMENT attribute remains unchanged, causing a duplicate entry error on subsequent inserts.
4. What is your TiDB version? (Required)
v8.1.0
The text was updated successfully, but these errors were encountered: