In a 1.11 branch I had a complex raw sql snippet added to a query set via 

When I updated Django to 2.0, the query set behavior changed to include the 
raw sql in the GROUP BY which destroyed the performance.

The same behavior occurred using annotate and extra.

I was able to hack around it by overwriting the get_group_by_cols on my 
RawSQL instance to return an empty list, but that seems wrong.

Is the new behavior a bug or a feature and is there a less hacky way of 
handling this?

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to