﻿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
11722	Query lookups that reference an F() expression produce invalid sql	plandry@…	Anssi Kääriäinen <akaariai@…>	"When using an iexact lookup, the sql generated is invalid. For example

{{{
MyObject.objects.filter(col1__iexact=F('col2'))
}}}

throws a syntax error. Here's an example of the SQL generated:

{{{
UPPER(""app_myobject"".""col1""::text) = UPPER() ""app_myobject"".""col2""
}}}

It's actually not working correctly for any lookup type that involves an expression, but only iexact produces sql that breaks because of the UPPER() function call. An exact lookup produces:

{{{
UPPER(""app_myobject"".""col1""::text) =  ""app_myobject"".""col2""
}}}

Notice the extra space between '=' and '""app_myobject"".""col2"".

I'm using Django trunk, and Postgresql 8.3."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed	F() expression query sql	hongshuning@… mumino	Ready for checkin	1	0	0	0	0	0
