Opened 15 years ago
Closed 15 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 |
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 by , 15 years ago
comment:2 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Could be a duplicate of #6669 (and possibly of #9964?).