mirror of
https://github.com/django/django.git
synced 2025-12-03 08:32:59 +00:00
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:
parent
b7bd7087e6
commit
89bf7a4525
2 changed files with 35 additions and 18 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue