Opened 10 years ago

Closed 10 years ago

#12565 closed (duplicate)

PostgresSQL does not rollback transactions from database errors.

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


When I decorate a function with @transaction.commit_on_success and an IntegrityError is thrown inside it, the transaction is not closed. I would expect it to rollback.

For instance, if I have a model with a unique_together constraint and violate that constraint in the function an IntegrityError is thrown. When I catch the IntegrityError outside the function and try to execute a select, PostgresSQL complains. From some initial debugging, is_dirty in the transaction module is not True for the function, so nothing is done to the transaction.

Change History (2)

comment:1 Changed 10 years ago by Ramiro Morales

Could be a duplicate of #6669 (and possibly of #9964?).

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

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top