Browse files

Fixed #21376 -- New implementation for query join promotion logic

This commit introduced a new class JoinPromoter that can be used to
abstract away join promotion problems for complex filter conditions.
Query._add_q() and Query.combine() now use the new class.

Also, added a lot of comments about why join promotion is done the way
it is.

Thanks to Tim Graham for original report and testing the changes, and
for Loic Bistuer for review.
  • Loading branch information...
1 parent ae029b4 commit 6fe2b001dba45134d7c10729c57959995e241a88 @akaariai akaariai committed Nov 4, 2013
Showing with 161 additions and 137 deletions.
  1. +1 −0 django/db/models/sql/
  2. +145 −135 django/db/models/sql/
  3. +2 −2 tests/queries/
  4. +13 −0 tests/queries/
@@ -60,6 +60,7 @@ def prepare_leaf(self, node, query, allow_joins):
field, sources, opts, join_list, path = query.setup_joins(
field_list, query.get_meta(),
query.get_initial_alias(), self.reuse)
+ self._used_joins = join_list
targets, _, join_list = query.trim_joins(sources, join_list, path)
if self.reuse is not None:
Oops, something went wrong.

0 comments on commit 6fe2b00

Please sign in to comment.