summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorFrancesco Panico <panico.francesco@gmail.com>2023-01-18 22:42:53 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-20 09:25:26 +0100
commit84927e110e813c3bea6a600e4474eb577e15f2b9 (patch)
tree9a51fcfc2b5d48e4a6f16bad5ab64448ef40074b /django/db/models/sql
parent3b6f3073444dd4fdfc769f995f920a4d5336fcf3 (diff)
[4.2.x] Fixed #34267 -- Fixed sliced QuerySet.union() crash.
Regression in 3d734c09ff0138441dfe0a59010435871d17950f. Thanks Raphaƫl Stefanini for the report. Backport of cc8aa6bf9c127a493e6dd005012b9e6397b3f319 from main
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/compiler.py3
1 files changed, 0 insertions, 3 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index 97ecd58bdd..7c433b3f06 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -532,15 +532,12 @@ class SQLCompiler:
"ORDER BY not allowed in subqueries of compound statements."
)
elif self.query.is_sliced and combinator == "union":
- limit = (self.query.low_mark, self.query.high_mark)
for compiler in compilers:
# A sliced union cannot have its parts elided as some of them
# might be sliced as well and in the event where only a single
# part produces a non-empty resultset it might be impossible to
# generate valid SQL.
compiler.elide_empty = False
- if not compiler.query.is_sliced:
- compiler.query.set_limits(*limit)
parts = ()
for compiler in compilers:
try: