Re: Are AutoField primary keys re-used after deleting an object from the db?
I'm pretty sure that OID is not reused. It's database behavior to control this and my guess is that Django does not use old object ids.
Futhermore there is a simple test that you can do:
Create a new object, delete it. Create a new object and check it's id.
George
On Sat, Oct 9, 2010 at 9:51 PM, Dirk <dirk.juelich@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.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
George R. C. Silva
Desenvolvimento em GIS
http://blog.geoprocessamento.net
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home