﻿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
11329	get_count generates incorrect SQL for query sets with extra 'select' and 'where'	bogklug	nobody	"Extending an example on extra 'select' from http://docs.djangoproject.com/en/1.0/ref/models/querysets/ with an extra 'with' and calling get_count:
{{{
Blog.objects.extra(
    select={
        'entry_count': 'SELECT COUNT(*) FROM blog_entry WHERE blog_entry.blog_id = blog_blog.id'
    },
    where=['entry_count=0']
).query.get_count()
}}}
results in OperationalError: no such column: entry_count.

The SQL for the query itself is ok. It seems that the problem is caused by get_count.
"		new	Database layer (models, ORM)	1.0			sql, extra select, extra where, get_count		Unreviewed	0	0	0	0		
