﻿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
25506	Can't filter over a RawSQL annotation	Antoine Catton	nobody	"Here's the simplest test case for this bug:

{{{
>>> User.objects.annotate(foo=RawSQL('%s', ['value', ])).filter(foo__iexact='value')
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File "".../django/db/models/query.py"", line 234, in __repr__
    data = list(self[:REPR_OUTPUT_SIZE + 1])
  File "".../django/db/models/query.py"", line 258, in __iter__
    self._fetch_all()
  File "".../django/db/models/query.py"", line 1074, in _fetch_all
    self._result_cache = list(self.iterator())
  File "".../django/db/models/query.py"", line 52, in __iter__
    results = compiler.execute_sql()
  File "".../django/db/models/sql/compiler.py"", line 852, in execute_sql
    cursor.execute(sql, params)
  File "".../django/db/backends/utils.py"", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "".../django/db/backends/utils.py"", line 64, in execute
    return self.cursor.execute(sql, params)
TypeError: not all arguments converted during string formatting
}}}

I'm working on a fix https://github.com/django/django/pull/5396"	Bug	closed	Database layer (models, ORM)	1.8	Normal	fixed	RawSQL filter ORM sql		Accepted	1	0	0	0	0	0
