summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorHisham Mahmood <hishammahmood41@gmail.com>2024-02-06 19:40:01 +0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-02-07 12:36:30 +0100
commitd79fba7d8e7bbcdf53535a14d57ead5a6863cd8d (patch)
tree1f888d03d2cf1c644acd48f8f2dd573c4341076e /django/db/models/sql/query.py
parent6ee37ada3241ed263d8d1c2901b030d964cbd161 (diff)
Fixed #35099 -- Prevented mutating queryset when combining with & and | operators.
Thanks Alan for the report. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 5100869b34..b3f130c0b4 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -696,6 +696,7 @@ class Query(BaseExpression):
# except if the alias is the base table since it must be present in the
# query on both sides.
initial_alias = self.get_initial_alias()
+ rhs = rhs.clone()
rhs.bump_prefix(self, exclude={initial_alias})
# Work out how to relabel the rhs aliases, if necessary.