'Regression test for #11916: Extra params + aggregation creates
incorrect SQL.'

@skipUnlessDBFeature('supports_subqueries_in_group_by')
def test_annotate_with_extra(self):

    shortest_book_sql = '\n                                SELECT    name\n                                FROM    aggregation_regress_book    b\n                                WHERE    b.publisher_id    =    aggregation_regress_publisher.id\n                                ORDER    BY    b.pages\n                                LIMIT    1\n                                '
    qs = Publisher.objects.extra(select={'name_of_shortest_book': shortest_book_sql}).annotate(total_books=Count('book'))
    list(qs)
