Does durable Django atomic transaction imply we don't need savepoints

Viewed 15

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=True then savepoint should ALWAYS be False, right? Because there's no point in using a savepoint if the atomic block is the outermost atomic block.
  • If durable=True, should Django set savepoint=False for us? Reading through the source code, it doesn't appear to do it for us but I feel like it should.
0 Answers
Related