#36116: prefetch_related() selects too many objects from a related table with a composite primary key and hidden related name -------------------------------------+------------------------------------- Reporter: Jacob Walls | Owner: Simon Type: | Charette Cleanup/optimization | Status: assigned Component: Database layer | Version: 5.2 (models, ORM) | Severity: Release blocker | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Comment (by Sarah Boyce):
> The `WHERE` is too permissive -- would expect both primary key columns to be checked, i.e. also "comment_id". Just to clarify, agreed the value of `comment_id` should be in the SQL but not a reference to the column `comment_id` (e.g. `WHERE ("composite_pk_user"."tenant_id" = 1 AND "composite_pk_user"."id" = 1)`) -- Ticket URL: <https://code.djangoproject.com/ticket/36116#comment:3> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/django-updates/0107019483fae5a1-dda9994b-6bbc-4794-a7d7-c197cc6f85ad-000000%40eu-central-1.amazonses.com.