On 5/1/07, Brandon Low <[EMAIL PROTECTED]> wrote:
>
> How can a get_or_create cause an integrity constraint error?

The error is on key 2, which is an additional unique index you
presumably have in your model. get_or_create should not cause
integrity errors on the primary key, but that's not what's happening
here.

>   File "/usr/lib/python2.4/site-packages/django/db/models/manager.py", line 
> 76, in get_or_create
>     return self.get_query_set().get_or_create(**kwargs)
>
>   File "/usr/lib/python2.4/site-packages/django/db/models/query.py", line 
> 279, in get_or_create
>     obj.save()
>
>   File "/usr/lib/python2.4/site-packages/django/db/models/base.py", line 238, 
> in save
>     ','.join(placeholders)), db_values)
>
>   File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 163, in 
> execute
>     self.errorhandler(self, exc, value)
>
>   File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 35, in 
> defaulterrorhandler
>     raise errorclass, errorvalue
>
> IntegrityError: (1062, "Duplicate entry 
> 'http://images.google.de/imgres?imgurl=http://www.lostlogicx.com/' for key 2")

-- 
Patriotism means to stand by the country. It does
not mean to stand by the president. -- T. Roosevelt

This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to