A Django atomic transaction has the durable and savepoint arguments. See docs.
durable=True ensures the atomic block is the outermost atomic block. Per the docs:
It is sometimes useful to ensure an atomic block is always the outermost atomic block, ensuring that any database changes are committed when the block is exited without errors. This is known as durability and can be achieved by setting durable=True
A PostgreSQL SAVEPOINT establishes a new savepoint within the current transaction. Sounds like this is only needed if the atomic block is nested.
I have the following questions:
- If
durable=Truethensavepointshould ALWAYS beFalse, right? Because there's no point in using a savepoint if the atomic block is the outermost atomic block. - If
durable=True, should Django setsavepoint=Falsefor us? Reading through the source code, it doesn't appear to do it for us but I feel like it should.