﻿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
815	[patch] select keyword to lookup_kwargs are being quoted incorrectly in query	rezzrovv	Adrian Holovaty	"Here is the issue:



{{{

@@ -1466,7 +1519,7 @@

     # Add any additional SELECTs passed in via kwargs.
     if kwargs.get('select'):
-        select.extend(['(%s) AS %s' % (s[1], s[0]) for s in kwargs['select']])
+        select.extend(['(%s) AS %s' % (db.db.quote_name(s[1]), db.db.quote_name(s[0])) for s in kwargs['select']])
}}}
If you have:
select={
        'choice_count': 'SELECT COUNT(*) FROM choices WHERE poll_id = polls.id'
    }
as described in the tutorial then you will get:
select somecol, (""SELECT COUNT(*) FROM choices WHERE poll_id = polls.id"") as ""choice_count"") from ...
versus
select somecol, (SELECT COUNT(*) FROM choices WHERE poll_id = polls.id) as ""choice_count"") from ...
as it should be.

Simply reverting this one line back works but not sure why it was changed in the first place.
"	defect	closed	Core (Other)		major	fixed			Unreviewed	1	0	0	0	0	0
