PostgresSQL does not rollback transactions from database errors.
|Reported by:||abhik||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.1|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||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.