﻿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
35444	Add generic support for order by to Aggregate	Chris M	Chris M	"We would like to add general support for ordering within SQL aggregate functions that allow it. Currently, this behavior is only supported in PostgreSQL via the `OrderableAggMixin`. With changes made in #35339 , it should be possible to merge the behaviors of that mixin into the core behaviors of the `Aggregate` class and then apply it to functions that support order by like Sqlite's `STRING_AGG`, MySQL's `GROUP_CONCAT`, and Oracle's `LIST_AGG WITHIN GROUP (ORDER BY)`.

These are some implementation notes from Simon discussed on the original bug ticket in this comment ticket:35339#comment:13 that I'm capturing some of here to avoid jumping around. 

> A few things I believe we should focus on along the way
>  1. We should make the argument Aggregate(order_by) instead of ordering to be consistent with Window
>  2. Just like we do with allow_distinct we should use a allow_order_by attribute for aggregates that support this feature
>  3. We should make OrderableAggMixin a shim that sets allow_order_by=True, redirect __init__(ordering) to order_by, and emit a deprecation warning when doing so to allow a proper transition for contrib.postgres.ArrayAgg and friends
>  4. We should reuse OrderByList as much as possible "	New feature	closed	Database layer (models, ORM)	dev	Normal	fixed	orderableaggmixin aggregate	Simon Charette	Ready for checkin	1	0	0	0	0	0
