summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-01-24 14:16:25 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-01-24 14:16:25 +0000
commit08dd4176edc1019d9168608b55fe777512c641cb (patch)
treea0f9f9e35fee167a11185af9751f3e63cdcc749c /django/db/models/sql
parentff78aef93b3b741e79176bbf96bf0918b44e3338 (diff)
Refs #10113 -- Modified the generated SQL to remove redundant GROUP BY elements, and modified the test added in [9788] to remove a test result that depended on a potentially ambiguous database ordering.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9791 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/query.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 6170cc48a4..88847d87e1 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -385,7 +385,8 @@ class BaseQuery(object):
# other than MySQL), then any fields mentioned in the
# ordering clause needs to be in the group by clause.
if not self.connection.features.allows_group_by_pk:
- grouping.extend(ordering_group_by)
+ grouping.extend([col for col in ordering_group_by
+ if col not in grouping])
else:
ordering = self.connection.ops.force_no_ordering()
result.append('GROUP BY %s' % ', '.join(grouping))