#1143 closed defect (fixed)
[patch] Incorrect joins in many to many kwarg queries
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | |
Severity: | normal | Keywords: | magic-removal unit test failure |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As a result of the lack of unit tests for many-to-many kwarg queries, the patch committed as r1792 introduced some backwards incompatibilities in the results returned by kwarg queries. Specifically, the join reuse behaviour of r1792 causes the join required for many-to-many intermediate table to be overwritten by the join required for the related table, resulting in an incorrect result set. This patch fixes this problem, and adds unit tests to prevent it from occurring again.
In addition, this patch adds the ability to form "reverse" many-to-many queries: i.e., kwarg queries starting on the class that does not contain the ManyToManyField. This was not previously possible, although the DB API docs imply that it should be. This feature is also unit tested.
This patch is provided against the magic-removal branch.
Attachments (1)
Change History (2)
by , 19 years ago
Attachment: | regression_and_reverse_m2m.patch added |
---|
comment:1 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch for regression of query behaviour, and reverse m2m queries