﻿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
17158	django.db.backends.BaseDatabaseOperations.last_executed_query can raise an exception	a.gerchenov@…	Aymeric Augustin	"Method ""last_executed_query"" should not always return ""smart_unicode(sql) % u_params"". If params variable is empty it should return just ""smart_unicode(sql)"". The problem is when we try to execute query with MySQL DATA_FORMAT function it says error.

Example:

{{{
from django.db import connection
c = connection.cursor()
c.execute(""SELECT * FROM VAR_current GROUP BY DATE_FORMAT(closing_month, '%Y-%m');"")
print c.fetchall()
}}}

Error:

{{{
django/db/backends/__init__.py"", line 216, in last_executed_query
    return smart_unicode(sql) % u_params
TypeError: not enough arguments for format string
}}}

This issue is closely related to #9055."	Bug	closed	Database layer (models, ORM)	1.2	Normal	fixed		rmanoch@…	Ready for checkin	1	0	0	0	0	0
