mirror of
https://github.com/django/django.git
synced 2025-08-09 13:28:18 +00:00
Fixed #24924 -- Join promotion for multiple Case expressions
This commit is contained in:
parent
f0450c9b12
commit
541f4ea546
3 changed files with 47 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue