Opened 12 years ago

Closed 11 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)

19154.diff (903 bytes ) - added by Tim Graham 11 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Claude Paroz, 12 years ago

Component: UncategorizedDocumentation
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

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.

by Tim Graham, 11 years ago

Attachment: 19154.diff added

comment:2 by Tim Graham, 11 years ago

Has patch: set

comment:3 by Claude Paroz, 11 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Tim Graham, 11 years ago

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