MySQL InnoDB AUTO_INCREMENT bug (next value to use forgotten at restart)
|Reported by:||Owned by:||Keith Edmiston|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I recently ran into problems with Django's automatic id field.
When the latest added object in a table was deleted, a new object created
some time later reused the same id value as the deleted object.
It turned out that this was due to the fact that I had restarted the
MySQL server between the deletion and the creation, and the fact
that the InnoDB backend does not remember the AUTO_INCREMENT value
when restarted (instead recreating it as "max(id)+1").
See for example http://bugs.mysql.com/bug.php?id=727
I guess there is not much that Django can do to fix this, but I think
the MySQL/InnoDB documentation should mention this peculiarity.
Change History (11)
comment:1 Changed 5 years ago by
|Patch needs improvement:||unset|
comment:2 Changed 5 years ago by
|Component:||Database layer (models, ORM) → Documentation|
|Triage Stage:||Unreviewed → Accepted|
|Type:||Bug → Cleanup/optimization|
comment:6 Changed 3 years ago by
|Owner:||changed from nobody to Keith Edmiston|
|Status:||new → assigned|