﻿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
26458	The Avg aggregate should only automatically resolves its output field to FloatField on numeric sources	Simon Charette	nobody	"Before #24649 was fixed it was simply not possible to use the `Avg` function on non-numeric sources.  The *good enough* solution was to allow use of the `output_field` kwarg and document it should be used when averaging `DurationField`.

As `DurationField` uses different underlying datatype for its storage (bigint, interval, ...) averaging on such fields [https://groups.google.com/d/msg/django-users/BwkK7R1WXYU/k4b5nzNwAQAJ might require or not] an explicit `output_field` and can be a source of confusion.

As the SQL `AVG` function only defaults to using floating value datatype as a return value when numeric input is used I suggest adjusting the `Avg` expression's `output_field` resolution to only use `FloatField` for default when its source field is an instance of one of Django's numerical field classes. This would lift the requirement of explicitly specifying an `output_field` when averaging `DurationField` on PostgreSQL.  "	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
