Opened 5 years ago

Closed 5 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: UI/UX:

Description

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 5 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 5 years ago by russellm

  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top