Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1143 closed defect (fixed)

[patch] Incorrect joins in many to many kwarg queries

Reported by: freakboy@… 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)

regression_and_reverse_m2m.patch (6.4 KB ) - added by freakboy@… 19 years ago.
Patch for regression of query behaviour, and reverse m2m queries

Download all attachments as: .zip

Change History (2)

by freakboy@…, 19 years ago

Patch for regression of query behaviour, and reverse m2m queries

comment:1 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

(In [1802]) magic-removal: Fixed #1143 -- Fixed backwards incompatibilities in many-to-many DB API lookups, added support for reverse many-to-many lookups, added unit tests. Thanks, Russ

Note: See TracTickets for help on using tickets.
Back to Top