Ticket #11329: sql-get-count-with-select-extra.patch

File sql-get-count-with-select-extra.patch, 701 bytes (added by joaoma@…, 15 years ago)

Check for extra_select in get_count

  • django/db/models/sql/query.py

     
    360360        Performs a COUNT() query using the current filter constraints.
    361361        """
    362362        obj = self.clone()
    363         if len(self.select) > 1 or self.aggregate_select:
     363        if len(self.select) > 1 or self.aggregate_select or self.extra_select:
    364364            # If a select clause exists, then the query has already started to
    365365            # specify the columns that are to be returned.
    366366            # In this case, we need to use a subquery to evaluate the count.
Back to Top