FYI: SQLite3 indeed re-uses primary keys if they are deleted from the tail of the sequence. (So I'll have to use a UUID as a permanent id.)
Thanks for your support. Dirk On Oct 10, 5:57 am, Russell Keith-Magee <russ...@keith-magee.com> wrote: > On Sunday, October 10, 2010,Dirk<dirk.juel...@googlemail.com> wrote: > > If I use > > > id = models.AutoField(primary_key=True) > > > can I be sure that if an object is removed from the db by calling > > its .delete() method, the respective id will not be used for any > > subsequent .save() on a new object? > > > My application relies on the fact that an object's id is unique over > > all objects, even deleted ones. > > The behavior of AutoField key allocation is entirely dependent on the > database you are using. You'll need to spend some quality time with > the documentation for your chosen database to determine if an > AutoField will do what you want. > > You may also want to investigate the use of UUIDs as a primary key. > Django doesn't have a built in UUID Field, but there are some > available as extension libraries. > > Yours, > Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.