mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #35064 -- Fixed Window(order_by) crash with DecimalFields on SQLite.
This avoids cast of Window(order_by) for DecimalFields on SQLite. This was achieved by piggy-backing ExpressionList which already implements a specialized as_sqlite() method to override the inherited behaviour of Func through SQLiteNumericMixin. Refs #31723. Thanks Quoates for the report.
This commit is contained in:
committed by
Mariusz Felisiak
parent
90d365d869
commit
e16d0c176e
@@ -1267,12 +1267,12 @@ class ExpressionList(Func):
|
||||
|
||||
def get_group_by_cols(self):
|
||||
group_by_cols = []
|
||||
for partition in self.get_source_expressions():
|
||||
group_by_cols.extend(partition.get_group_by_cols())
|
||||
for expr in self.get_source_expressions():
|
||||
group_by_cols.extend(expr.get_group_by_cols())
|
||||
return group_by_cols
|
||||
|
||||
|
||||
class OrderByList(Func):
|
||||
class OrderByList(ExpressionList):
|
||||
allowed_default = False
|
||||
template = "ORDER BY %(expressions)s"
|
||||
|
||||
@@ -1287,17 +1287,6 @@ class OrderByList(Func):
|
||||
)
|
||||
super().__init__(*expressions, **extra)
|
||||
|
||||
def as_sql(self, *args, **kwargs):
|
||||
if not self.source_expressions:
|
||||
return "", ()
|
||||
return super().as_sql(*args, **kwargs)
|
||||
|
||||
def get_group_by_cols(self):
|
||||
group_by_cols = []
|
||||
for order_by in self.get_source_expressions():
|
||||
group_by_cols.extend(order_by.get_group_by_cols())
|
||||
return group_by_cols
|
||||
|
||||
|
||||
@deconstructible(path="django.db.models.ExpressionWrapper")
|
||||
class ExpressionWrapper(SQLiteNumericMixin, Expression):
|
||||
|
||||
Reference in New Issue
Block a user