summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2017-09-02 22:39:51 +0200
committerTim Graham <timograham@gmail.com>2017-09-02 16:39:51 -0400
commit2470756de0b21c1ff15758a88e167d08da23e5f7 (patch)
tree59ae3c34a3fafd16f6aad7f9448e275fd8027d4f
parent48d92fea672928b4571ddaab03667e74671391c0 (diff)
Moved select_sql in SQLCompiler.get_extra_select() to improve performance.
-rw-r--r--django/db/models/sql/compiler.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index 2afc3635fa..743803338b 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -357,8 +357,8 @@ class SQLCompiler:
def get_extra_select(self, order_by, select):
extra_select = []
- select_sql = [t[1] for t in select]
if self.query.distinct and not self.query.distinct_fields:
+ select_sql = [t[1] for t in select]
for expr, (sql, params, is_ref) in order_by:
without_ordering = self.ordering_parts.search(sql).group(1)
if not is_ref and (without_ordering, params) not in select_sql: