﻿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
18333	Aggregating an annotated field does not quote the alias column name	Michael Manfre	nobody	"Given the below code snippet from aggregation.BaseAggregateTestCase.test_aggregate_annotation:

{{{
vals = Book.objects.annotate(num_authors=Count(""authors__id"")).aggregate(Avg(""num_authors""))
}}}

The generated SQL does not quote the annotated field ""num_authors"" when used with the aggregate function. Generated SQL is of the form:

{{{
SELECT AVG(num_authors) FROM (... subquery ...)
}}}

"	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed	aggregate,annotate		Accepted	1	0	0	0	0	0
