Fixed #20528 -- regression in select_related join promotion

The join used by select_related was incorrectly INNER when the query
had an ORed filter for nullable join that was trimmed away. Fixed this
by forcing the join type to LOUTER even when a join was trimmed away
in ORed queries.
This commit is contained in:
Anssi Kääriäinen 2013-06-10 18:22:30 +03:00
parent b7bd7087e6
commit 89bf7a4525
2 changed files with 35 additions and 18 deletions

View file

@ -1913,5 +1913,7 @@ def alias_diff(refcounts_before, refcounts_after):
Given the before and after copies of refcounts works out which aliases
have been added to the after copy.
"""
# Use -1 as default value so that any join that is created, then trimmed
# is seen as added.
return set(t for t in refcounts_after
if refcounts_after[t] > refcounts_before.get(t, 0))
if refcounts_after[t] > refcounts_before.get(t, -1))