Avoided unnecessary call to .get_source_expressions().

The SQLCompiler._order_by_pairs() generator method yields instances of
OrderBy and not Expression.
This commit is contained in:
Simon Charette 2022-07-04 16:32:16 +01:00 committed by Mariusz Felisiak
parent c583418e3e
commit a142edcc49
1 changed files with 2 additions and 2 deletions

View File

@ -436,8 +436,8 @@ class SQLCompiler:
for expr, is_ref in self._order_by_pairs(): for expr, is_ref in self._order_by_pairs():
resolved = expr.resolve_expression(self.query, allow_joins=True, reuse=None) resolved = expr.resolve_expression(self.query, allow_joins=True, reuse=None)
if self.query.combinator and self.select: if self.query.combinator and self.select:
src = resolved.get_source_expressions()[0] src = resolved.expression
expr_src = expr.get_source_expressions()[0] expr_src = expr.expression
# Relabel order by columns to raw numbers if this is a combined # Relabel order by columns to raw numbers if this is a combined
# query; necessary since the columns can't be referenced by the # query; necessary since the columns can't be referenced by the
# fully qualified name and the simple column names may collide. # fully qualified name and the simple column names may collide.