﻿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
11104	HAVING filter screws with extra() SQL parameter ordering	miracle2k		"{{{
>>> qs = Model.objects.extra(where=['foo>%s'], params=[2]).annotate(count=Count('bar')).filter(bar=99)
>>> qs.query.as_sql()
('SELECT `site_publication`.`id`, ..., FROM ... WHERE foo > %s GROUP BY ... HAVING bar > %s',
 (99, 2))
}}}

As you can see, the parameters (99 and 2) are in the wrong order. ""foo"", the first filter, should be evaluated against 2, and bar, the second one, against 99.

If ""bar"" is not an aggregate, it works, because apparently the filter would be placed in the WHERE clause *before* the ""extra()"" where.

Using rev. 10743."	Bug	closed	Database layer (models, ORM)	dev	Normal	wontfix	QuerySet.extra	bas@… shaunc@…	Accepted	0	0	0	0	0	0
