1
0
mirror of https://github.com/django/django.git synced 2025-10-29 00:26:07 +00:00

[1.8.x] Fixed #24924 -- Join promotion for multiple Case expressions

Backport of 541f4ea546 from master
This commit is contained in:
Mark Lavin
2015-06-05 10:48:57 -04:00
committed by Tim Graham
parent 469f1e362b
commit 0cfb7ed5c5
3 changed files with 47 additions and 3 deletions

View File

@@ -87,10 +87,8 @@ class Q(tree.Node):
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
# We must promote any new joins to left outer joins so that when Q is
# used as an expression, rows aren't filtered due to joins.
joins_before = query.tables[:]
clause, joins = query._add_q(self, reuse, allow_joins=allow_joins, split_subq=False)
joins_to_promote = [j for j in joins if j not in joins_before]
query.promote_joins(joins_to_promote)
query.promote_joins(joins)
return clause
@classmethod