summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/models/sql/query.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index aaf35ee37c..fe8ac873b1 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -846,6 +846,9 @@ class Query(BaseExpression):
relabelling any references to them in select columns and the where
clause.
"""
+ # If keys and values of change_map were to intersect, an alias might be
+ # updated twice (e.g. T4 -> T5, T5 -> T6, so also T4 -> T6) depending
+ # on their order in change_map.
assert set(change_map).isdisjoint(change_map.values())
# 1. Update references in "select" (normal columns plus aliases),