﻿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
6400	extra() with LIKE and params breaks	 	nobody	"What I am seeing is this. I think it is somehow related to the mass use of the percentage char. I couldn't get it to work on both sqlite and PostgreSQL 7.4

{{{
>>> Speaker.objects.extra(where=['first_name LIKE ""%%bla%%""'])
[]
>>> Speaker.objects.extra(where=['first_name = %s'], params=['bla'])
[]
>>> Speaker.objects.extra(where=['first_name LIKE ""%%%s%%""'], params=['bla'])
Traceback (most recent call last):
  File ""<console>"", line 1, in ?
  File ""/usr/lib/python2.4/site-packages/django/db/models/query.py"", line 108, in __repr__
    return repr(self._get_data())
  File ""/usr/lib/python2.4/site-packages/django/db/models/query.py"", line 483, in _get_data
    self._result_cache = list(self.iterator())
  File ""/usr/lib/python2.4/site-packages/django/db/models/query.py"", line 189, in iterator
    cursor.execute(""SELECT "" + (self._distinct and ""DISTINCT "" or """") + "","".join(select) + sql, params)
  File ""/usr/lib/python2.4/site-packages/django/db/backends/util.py"", line 18, in execute
    return self.cursor.execute(sql, params)
  File ""/usr/lib/python2.4/site-packages/django/db/backends/sqlite3/base.py"", line 133, in execute
    return Database.Cursor.execute(self, query, params)
ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.
}}}

As a model to try with this should suffice:

{{{
class Speaker(models.Model):
    first_name = models.CharField(max_length=25)
}}}"		closed	Database layer (models, ORM)	dev		invalid			Accepted	0	0	0	0	0	0
