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 11090 Query.group_by no longer supports MySQL specific behaviour miracle2k "I used to be able to do: {{{ qs = Model.objects.extra(select={'foo': 'custom_aggregate()'}, tables=['table']) qs.query.group_by = ['table.column'] }}} This generated a query like: {{{ SELECT model.a, model.b, custom_aggregate() AS foo FROM model, table GROUP BY table.column }}} As far as I understand, this is exploiting MySQL specific behaviour that supports collapsing multiple values within a group into a single return row, rather than enforcing every column to be either listed in GROUP BY, or be an aggregate, as Postgre does, for example. Now, with the changes from r9805 and later also r9838, when using any kind of group_by value at all, the resulting query will actually list all select, select_related and extra_select fields in the GROUP BY clause, meaning my query is now: {{{ SELECT model.a, model.b, custom_aggregate() AS foo FROM model, table GROUP BY table.column, model.a, model.b, foo }}} I realize that group_by is internal API and Django may not want to support this at all, but in case the change was unintentional, I thought I'd bring it up." closed Database layer (models, ORM) dev wontfix Unreviewed 0 0 0 0 0 0