mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[2.2.x] Fixed #30315 -- Fixed crash of ArrayAgg and StringAgg with ordering when used in Subquery.
Backport of a3f91891d2 from master.
This commit is contained in:
committed by
Mariusz Felisiak
parent
5bf2c87ece
commit
1172f078eb
@@ -33,6 +33,12 @@ class OrderableAggMixin:
|
||||
return sql, sql_params + ordering_params
|
||||
return super().as_sql(compiler, connection, ordering='')
|
||||
|
||||
def set_source_expressions(self, exprs):
|
||||
# Extract the ordering expressions because ORDER BY clause is handled
|
||||
# in a custom way.
|
||||
self.ordering = exprs[self._get_ordering_expressions_index():]
|
||||
return super().set_source_expressions(exprs[:self._get_ordering_expressions_index()])
|
||||
|
||||
def get_source_expressions(self):
|
||||
return self.source_expressions + self.ordering
|
||||
|
||||
|
||||
Reference in New Issue
Block a user