summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/compiler.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index 8b0fd1da46..27b8cc343b 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -411,7 +411,11 @@ class SQLCompiler:
# must have the same columns list. Set the selects defined on
# the query on all combined queries, if not already set.
if not compiler.query.values_select and self.query.values_select:
- compiler.query.set_values((*self.query.values_select, *self.query.annotation_select))
+ compiler.query.set_values((
+ *self.query.extra_select,
+ *self.query.values_select,
+ *self.query.annotation_select,
+ ))
parts += (compiler.as_sql(),)
except EmptyResultSet:
# Omit the empty queryset with UNION and with DIFFERENCE if the