Changes between Initial Version and Version 1 of Ticket #36785, comment 5


Ignore:
Timestamp:
Dec 8, 2025, 11:02:33 PM (3 weeks ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36785, comment 5

    initial v1  
    33Prior to #36490 (e1671278e88265e64811657b8b939b5d786295cb) `bulk_create` was always creating an implicit transaction even if it only needed to issue a single `INSERT`.
    44
    5 Now that no explicit `transaction.atomic` usage is made the database error your RLS policy triggers and don't let the error reach `transaction.Atomic.__exit__` which goes against its documented usage (see [https://docs.djangoproject.com/en/6.0/topics/db/transactions/#django.db.transaction.atomic Avoid catching exceptions inside atomic!]) it leaves the current transaction in an incoherent state.
     5Now that no explicit `transaction.atomic` usage is made the database error your RLS policy triggers is not allowed to reach `transaction.Atomic.__exit__` in your test which goes against its documented usage (see [https://docs.djangoproject.com/en/6.0/topics/db/transactions/#django.db.transaction.atomic Avoid catching exceptions inside atomic!]) it leaves the current transaction in an incoherent state.
    66
    77TL;DR your usage of `transaction.atomic` is incorrect but it was masked by `bulk_create` creating a nested `atomic` previously (which was implementation detail) and you should do the following instead
Back to Top