summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-08-20 12:46:14 -0400
committerTim Graham <timograham@gmail.com>2015-09-05 08:19:38 -0400
commit62347208bb0cef6990699d7373fa06e2e12ead07 (patch)
tree843d89b762630dc6a290d98edc0aa26763b5fada /django
parentf1d6b5b5b1c8a3461e7bb90760531cf5725b59be (diff)
[1.8.x] Fixed #24525 -- Fixed AssertionError in some complex queries.
Thanks Anssi Kääriäinen for providing the solution. Backport of 2dc9ec5616a942de3a0886a707f93988f56dd594 from master
Diffstat (limited to 'django')
-rw-r--r--django/db/models/sql/query.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 7a0fe8f892..40b6cc57a1 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -539,7 +539,8 @@ class Query(object):
# distinct joins for the same connection in rhs query, then the
# combined query must have two joins, too.
reuse.discard(new_alias)
- change_map[alias] = new_alias
+ if alias != new_alias:
+ change_map[alias] = new_alias
if not rhs.alias_refcount[alias]:
# The alias was unused in the rhs query. Unref it so that it
# will be unused in the new query, too. We have to add and