diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-08-06 17:59:31 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-08-06 18:00:38 +0200 |
| commit | d9ace347b4e38d9eac01d7a17a68b009c81f5c06 (patch) | |
| tree | dda35992f29d5ebdd42380ae51c599a76bccd590 /django | |
| parent | d3ef502aa97520838b819483218ea01f33ea5a20 (diff) | |
[4.1.x] Fixed #33898 -- Fixed Window() expression crash with ArrayAgg().
Thanks Kia for the report.
Regression in e06dc4571ea9fd5723c8029959b95808be9f8812.
Backport of fd93db97c7228b16a4f92f97ef05b0d72418d952 from main
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/expressions.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 0eb70b057d..5d23c1572f 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -1669,7 +1669,7 @@ class Window(SQLiteNumericMixin, Expression): if not connection.features.supports_over_clause: raise NotSupportedError("This backend does not support window expressions.") expr_sql, params = compiler.compile(self.source_expression) - window_sql, window_params = [], [] + window_sql, window_params = [], () if self.partition_by is not None: sql_expr, sql_params = self.partition_by.as_sql( @@ -1678,24 +1678,23 @@ class Window(SQLiteNumericMixin, Expression): template="PARTITION BY %(expressions)s", ) window_sql.append(sql_expr) - window_params.extend(sql_params) + window_params += tuple(sql_params) if self.order_by is not None: order_sql, order_params = compiler.compile(self.order_by) window_sql.append(order_sql) - window_params.extend(order_params) + window_params += tuple(order_params) if self.frame: frame_sql, frame_params = compiler.compile(self.frame) window_sql.append(frame_sql) - window_params.extend(frame_params) + window_params += tuple(frame_params) - params.extend(window_params) template = template or self.template return ( template % {"expression": expr_sql, "window": " ".join(window_sql).strip()}, - params, + (*params, *window_params), ) def as_sqlite(self, compiler, connection): |
