diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/sql/query.py | 3 |
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 |
