mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
If an SQL query doesn't specify any ordering, avoid the implicit sort
that happens with MySQL when a "GROUP BY" clause is included. This is a backend-specific operation, so any other databases requiring similar encouragement can have a function added to their own backend code. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -288,6 +288,8 @@ class BaseQuery(object):
|
||||
if self.group_by:
|
||||
grouping = self.get_grouping()
|
||||
result.append('GROUP BY %s' % ', '.join(grouping))
|
||||
if not ordering:
|
||||
ordering = self.connection.ops.force_no_ordering()
|
||||
|
||||
if self.having:
|
||||
having, h_params = self.get_having()
|
||||
|
||||
Reference in New Issue
Block a user