mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Added support for modifying the effect of `DISTINCT` clauses so they
only consider some fields (PostgreSQL only). For this, the ``distinct()`` QuerySet method now accepts an optional list of model fields names and generates ``DISTINCT ON`` clauses on these cases. Thanks Jeffrey Gelens and Anssi Kääriäinen for their work. Fixes #6422. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -40,9 +40,9 @@ class SelectRelatedRegressTests(TestCase):
|
||||
self.assertEqual([(c.id, unicode(c.start), unicode(c.end)) for c in connections],
|
||||
[(c1.id, u'router/4', u'switch/7'), (c2.id, u'switch/7', u'server/1')])
|
||||
|
||||
# This final query should only join seven tables (port, device and building
|
||||
# twice each, plus connection once).
|
||||
self.assertEqual(connections.query.count_active_tables(), 7)
|
||||
# This final query should only have seven tables (port, device and building
|
||||
# twice each, plus connection once). Thus, 6 joins plus the FROM table.
|
||||
self.assertEqual(str(connections.query).count(" JOIN "), 6)
|
||||
|
||||
|
||||
def test_regression_8106(self):
|
||||
|
||||
Reference in New Issue
Block a user