Do you have the transaction middleware enabled?  Given that you do not
have unique constraints on field Y/Z, I believe this would be the
expected behavior with transactions enabled.

Both threads conceptually have their own "picture" of what the
database looked like when the transaction was started.  That isolation
exists until the transaction is ultimately committed.

At the risk of over-explaining and over-simplifying, if the record did
not exist at the time each thread started its transaction, then it
doesn't matter that T1 hit the save operation first, T2 will not see
it.

If you're not using transactions then ignore my explanation, but it
might help to know which database engine you are using.

On 9/25/07, PyMan <[EMAIL PROTECTED]> wrote:

> time 1 : T1 (thread 1) call get_or_create and does the self.get and it
> goes in exception for DoesNotExists
> time 2 : T2 do the same and goes in exception too for the same reason
> time 3 : T1 goes on with the exception and creates the object and
> gives it back
> time 4 : T2 the same (creating another one!)
> time 5 : any T (T1 or T2 or T3) who calls get_or_create again with
> same X-Y/Z...the self.get gets crazy.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to