Code

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#1143 closed defect (fixed)

[patch] Incorrect joins in many to many kwarg queries

Reported by: freakboy@… Owned by: adrian
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: UI/UX:

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@… 9 years ago.
Patch for regression of query behaviour, and reverse m2m queries

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by freakboy@…

Patch for regression of query behaviour, and reverse m2m queries

comment:1 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.