Changes between Version 1 and Version 2 of Ticket #36785, comment 5
- Timestamp:
- Dec 8, 2025, 11:03:08 PM (3 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36785, comment 5
v1 v2 3 3 Prior to #36490 (e1671278e88265e64811657b8b939b5d786295cb) `bulk_create` was always creating an implicit transaction even if it only needed to issue a single `INSERT`. 4 4 5 Now 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 incoherentstate.5 Now 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!]) and leaves the connection in a unusable state. 6 6 7 7 TL;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