Changes between Initial Version and Version 3 of Ticket #17946


Ignore:
Timestamp:
Jul 7, 2012, 3:19:04 AM (12 years ago)
Author:
Jannis Leidel
Comment:

Updated formatting

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17946

    • Property Cc pmountifield@… gerdemb added
  • Ticket #17946 – Description

    initial v3  
    88You will get a IntegrityError and trackback as follows:
    99
    10 Problem installing fixture 'test.json': Traceback (most recent call last):
    11   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/core/management/commands/loaddata.py", line 174, in handle
    12     obj.save(using=using)
    13   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/core/serializers/base.py", line 168, in save
    14     setattr(self.object, accessor_name, object_list)
    15   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/fields/related.py", line 749, in __set__
    16     manager.add(*value)
    17   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/fields/related.py", line 507, in add
    18     self._add_items(self.target_field_name, self.source_field_name, *objs)
    19   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/fields/related.py", line 590, in _add_items
    20     '%s_id' % target_field_name: obj_id,
    21   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/query.py", line 360, in create
    22     obj.save(force_insert=True, using=self.db)
    23   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/base.py", line 460, in save
    24     self.save_base(using=using, force_insert=force_insert, force_update=force_update)
    25   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/base.py", line 553, in save_base
    26     result = manager._insert(values, return_id=update_pk, using=using)
    27   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/manager.py", line 195, in _insert
    28     return insert_query(self.model, values, **kwargs)
    29   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/query.py", line 1436, in insert_query
    30     return query.get_compiler(using=using).execute_sql(return_id)
    31   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/sql/compiler.py", line 791, in execute_sql
    32     cursor = super(SQLInsertCompiler, self).execute_sql(None)
    33   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/sql/compiler.py", line 735, in execute_sql
    34     cursor.execute(sql, params)
    35   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/backends/util.py", line 34, in execute
    36     return self.cursor.execute(sql, params)
    37   File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    38     return self.cursor.execute(query, args)
    39 IntegrityError: duplicate key violates unique constraint "webpage_related_from_webpage_id_key"
     10{{{
     11  Problem installing fixture 'test.json': Traceback (most recent call last):
     12    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/core/management/commands/loaddata.py", line 174, in handle
     13      obj.save(using=using)
     14    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/core/serializers/base.py", line 168, in save
     15      setattr(self.object, accessor_name, object_list)
     16    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/fields/related.py", line 749, in __set__
     17      manager.add(*value)
     18    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/fields/related.py", line 507, in add
     19      self._add_items(self.target_field_name, self.source_field_name, *objs)
     20    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/fields/related.py", line 590, in _add_items
     21      '%s_id' % target_field_name: obj_id,
     22    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/query.py", line 360, in create
     23      obj.save(force_insert=True, using=self.db)
     24    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/base.py", line 460, in save
     25      self.save_base(using=using, force_insert=force_insert, force_update=force_update)
     26    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/base.py", line 553, in save_base
     27      result = manager._insert(values, return_id=update_pk, using=using)
     28    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/manager.py", line 195, in _insert
     29      return insert_query(self.model, values, **kwargs)
     30    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/query.py", line 1436, in insert_query
     31      return query.get_compiler(using=using).execute_sql(return_id)
     32    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/sql/compiler.py", line 791, in execute_sql
     33      cursor = super(SQLInsertCompiler, self).execute_sql(None)
     34    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/models/sql/compiler.py", line 735, in execute_sql
     35      cursor.execute(sql, params)
     36    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/backends/util.py", line 34, in execute
     37      return self.cursor.execute(sql, params)
     38    File "/usr/local/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
     39      return self.cursor.execute(query, args)
     40  IntegrityError: duplicate key violates unique constraint "webpage_related_from_webpage_id_key"
     41}}}
    4042
    4143The reason for the error is exactly what it says it is, there is already a related item with the same to and from ids in the related table, the question was why. A little digging uncovered the following:
Back to Top