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.