Opened 10 years ago

Closed 10 years ago

#7578 closed (invalid)

error in any ORM operations after 'duplicate key violation'

Reported by: san@… Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


create models

class TestCommon(models.Model):
	name=models.CharField(max_length=10, unique=True)
class Test1(TestCommon):
class Test2(TestCommon):


python shell
>>> from mysite.cp.models import TestCommon, Test1, Test2
>>> Test1.objects.create(name='test2',num1=1)
<Test1: Test1 object>
-- this works good
-- this returns error 'duplicate key violation' in name field

-- now this will not work

and any other request will not work too

I have Checked out revision 7810.

DATABASE_ENGINE = 'postgresql_psycopg2'

Change History (1)

comment:1 Changed 10 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

This is a feature of the Postgres transactions; once an error is found on the cursor, you need to roll back the transaction to remove the effect of the error.

Note: See TracTickets for help on using tickets.
Back to Top