#25506 closed Bug (fixed)
Can't filter over a RawSQL annotation
Reported by: | Antoine Catton | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.8 |
Severity: | Normal | Keywords: | RawSQL filter ORM sql |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Change History (4)
comment:1 by , 9 years ago
Severity: | Release blocker → Normal |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In b971c1cd: