MySQL InnoDB AUTO_INCREMENT bug (next value to use forgotten at restart)
|Reported by:||kent@…||Owned by:||kedmiston|
|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 ramiro
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 5 years ago by aaugustin
- Component changed from Database layer (models, ORM) to Documentation
- Triage Stage changed from Unreviewed to Accepted
- Type changed from Bug to Cleanup/optimization
comment:6 Changed 3 years ago by kedmiston
- Owner changed from nobody to kedmiston
- Status changed from new to assigned
comment:9 Changed 3 years ago by timo
- Resolution set to fixed
- Status changed from assigned to closed