﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33898	Window() expression with ArrayAgg() crashes.	Kia	Mariusz Felisiak	"The following query raises an AttributeError.

{{{

from django.contrib.postgres.aggregates import ArrayAgg
from django.db.models.expressions import Window

SampleModel.objects.all().annotate(
    sample_field=Window(
        expression=ArrayAgg(""field_three""),
        partition_by=[""field_one"", ""field_two""],
    )
)
}}}

Traceback:

{{{
File ""/usr/local/lib/python3.10/site-packages/django/db/models/expressions.py"", line 1693, in as_sql
  params.extend(window_params)
AttributeError: 'tuple' object has no attribute 'extend'
}}}

Works in Django 4.0.6 (maybe even in 4.0.7, didn't try) but broken in Django 4.1.

Seems like in OrderableAggMixin (https://github.com/django/django/blob/4.1/django/contrib/postgres/aggregates/mixins.py#L23) it used to return a `list` as second value, but now it's a `tuple` that breaks `params.extend()` in https://github.com/django/django/blob/4.1/django/db/models/expressions.py#L1693"	Bug	closed	Database layer (models, ORM)	4.1	Release blocker	fixed	ArrayAgg, Window function, extend, tuple, params	Simon Charette	Accepted	1	0	0	0	0	0
