Hi Raphael,
On Tue, 12 Oct 2021 11:28:20 +0200
Raphael Michel <
ma...@raphaelmichel.de> wrote:
> In our case, "not using savepoint rollbacks any more" would be a
> trade-off that we'd happily make (there are enough other problems
> with savepoints to begin with)
You seem to imply that savepoint rollbacks are a very easy feature to
avoid, but I think this is not the case -- in a big part, because some
of them are hidden away from user code.
Any example within a transaction of
try:
with transaction.atomic():
my_model.save()
except SomeException:
handle_error()
do_something_else_touching_db()
is, explicitly, a savepoint-rollback in the error case, and one you may
need because of side-effects of save() (e.g. in signal handlers). But
even an innocuous
my_model.save()
can induce a savepoint rollback, in case you're using MTI.
You can, maybe, achieve something using database instrumentation --
identify when a "COMMIT" is sent to the database at the SQL level, and
do something before that. But that, also, sounds dangerous.
HTH,
Shai.