#19547 closed Bug (fixed)
Queryset.__or__ and caching of known related instances breaking
Reported by: | Marc Tamlyn | Owned by: | Aymeric Augustin |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.5-beta-1 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you or together two querysets with known related instances then you can get some incorrect data:
If you do instance_1.foo_set.all() | instance_2.foo_set.all()
then all of the foos will have foo.instance == instance1
even though foo.instance_id == instance2.pk
.
I have a failing test case and a partial fix on github at https://github.com/mjtamlyn/django/compare/known-related-objects-queryset-or
The fix does ensure data is integral but it doesn't have the full efficiency improvement. I'm also working on a fix which solves the efficiency as well but it doesn't feel "right"...
Change History (5)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
The patch looks good.
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Branch updated with a fix for the efficiency part of the test.