#27403: prefetch_related doesn't guarantee transactional consistency
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Rivo Laks):
Correct me if I'm wrong, but I think just wrapping the
`prefetch_related()` in a transaction wouldn't fix this.
By default, at least in Postgres, queries made within a transaction can
still see data from other _committed_ transactions, so the same problem
would occur.
In Postgres, you could select a higher isolation level, I think Repeatable
Read would prevent the case you've described. But this has other
consequences and should be done on per-app basis. See
https://www.postgresql.org/docs/current/static/transaction-iso.html for
more info.
If I'm right, maybe docs should note that there might be edge cases
regards transactional consistency?
--
Ticket URL: <https://code.djangoproject.com/ticket/27403#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.4d359a0451aeef960a53bb58cda9d014%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.