Opened 13 years ago
Closed 13 years ago
#19154 closed Cleanup/optimization (fixed)
TransactionManagementError raised when data is not changed
| Reported by: | alexander smishlajev | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 1.4 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
According to Django documentation, a commit_manually decorator would raise TransactionManagementError if decorated block changes data and doesn't commit() or rollback().
Actually, TransactionManagementError is raised when no data is changed, but some SELECT statements were executed by model managers.
If that is intended behavior, Django documentation should reflect it, but it would be better if SELECT statements could run without commit or rollback.
Attachments (1)
Change History (5)
comment:1 by , 13 years ago
| Component: | Uncategorized → Documentation |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → Cleanup/optimization |
by , 13 years ago
| Attachment: | 19154.diff added |
|---|
comment:2 by , 13 years ago
| Has patch: | set |
|---|
comment:3 by , 13 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:4 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Yes, this is intended behaviour and the documentation should be updated. The behaviour is explicitely tested (see transactions_regress tests). You can read lengthy related discussions on #9964. It is not possible for Django to really know if data have been modified or not, as SELECT-only statements can modify data.