mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.8.x] Fixed #24921 -- set_autocommit(False) + ORM queries.
This commits lifts the restriction that the outermost atomic block must
be declared with savepoint=False. This restriction was overly cautious.
The logic that makes it safe not to create savepoints for inner blocks
also applies to the outermost block when autocommit is disabled and a
transaction is already active.
This makes it possible to use the ORM after set_autocommit(False).
Previously it didn't work because ORM write operations are protected
with atomic(savepoint=False).
Backport of 91e9f1c from master
This commit is contained in:
@@ -200,8 +200,12 @@ Django provides a single API to control database transactions.
|
||||
the error handling described above.
|
||||
|
||||
You may use ``atomic`` when autocommit is turned off. It will only use
|
||||
savepoints, even for the outermost block, and it will raise an exception
|
||||
if the outermost block is declared with ``savepoint=False``.
|
||||
savepoints, even for the outermost block.
|
||||
|
||||
.. versionchanged:: 1.8.5
|
||||
|
||||
Previously the outermost atomic block couldn't be declared with
|
||||
``savepoint=False`` when autocommit was turned off.
|
||||
|
||||
.. admonition:: Performance considerations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user