Opened 5 years ago

Closed 5 years ago

#24923 closed Cleanup/optimization (fixed)

Aggregates in order_by should error out nicely

Reported by: Anssi Kääriäinen Owned by: Tim Graham <timograham@…>
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Expressions are allowed in order_by, but aggregates don't currently work. Making them work would cause too much trouble when taking in account that you can already do

qs.annotate(agg=Sum('foo')).order_by('agg')

as opposed to

qs.order_by(Sum('foo'))

Change History (5)

comment:1 Changed 5 years ago by Rigel Di Scala

Owner: changed from nobody to Rigel Di Scala
Status: newassigned

akaariai: what would you suggest as the error message or behaviour?

comment:2 Changed 5 years ago by Rigel Di Scala

Owner: Rigel Di Scala deleted
Status: assignednew

comment:3 Changed 5 years ago by Simon Charette

Patch needs improvement: set
Version: 1.8master

Left notes on the PR.

comment:4 Changed 5 years ago by Anssi Kääriäinen

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

I've fixed all review issues.

comment:5 Changed 5 years ago by Tim Graham <timograham@…>

Owner: set to Tim Graham <timograham@…>
Resolution: fixed
Status: newclosed

In 6f40305:

Fixed #24923 -- errored out nicely when using aggregates in order_by()

Note: See TracTickets for help on using tickets.
Back to Top