Fixed #24924 -- Join promotion for multiple Case expressions

This commit is contained in:
Mark Lavin 2015-06-05 10:48:57 -04:00 committed by Tim Graham
parent f0450c9b12
commit 541f4ea546
3 changed files with 47 additions and 3 deletions

View file

@ -89,10 +89,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