I've looked into this further, and it looks like it's actually an issue with
PostgreSQL, not django.  The field I'm querying is of type inet, and I'm
inputting an IPv6 address.  However, it appears that in PostgreSQL (running
version 8.3.5) IPv6 addresses only match a query when the string being
queried is in compressed IPv6 format (e.g., ::1).  So, when I run a
model.objects.get_or_create(ip=myipv6) where myipv6 was not in compressed
format, the get() would fail, and the insert would fail because the address
really does already exist, but then the subsequent get() would fail again.

Regards,
Casey

On Mon, Dec 22, 2008 at 2:47 PM, Casey Deccio <[email protected]> wrote:

> Hi,
>
> I'm running django-1.0 in a multi-threaded application (PostgreSQL
> backend), and I'm getting an IntegrityError occasionally when I run a
> model.objects.get_or_create().  I can see in the get_or_create() method of
> db/models/query.py that it excepts an Integrity error, and then rolls back
> the transaction and tries to get the object.  I can see from the traceback
> that this get() raises a model.DoesNotExist, which then causes it to
> re-raise the IntegrityError that was saved previously.  I'm not doing any
> changes or deletions in any other threads.  Any ideas as to what I'm
> missing?
>
> Regards,
> Casey
>

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

Reply via email to