Skip to content

Commit

Permalink
Fixed #7791 -- Fixed a really silly error I introduced in [7926]. :-(
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8052 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Jul 22, 2008
1 parent 0e9587f commit 83e97ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions django/db/models/sql/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -1616,8 +1616,9 @@ def execute_sql(self, result_type=MULTI):
if self.ordering_aliases:
result = order_modified_iter(cursor, len(self.ordering_aliases),
self.connection.features.empty_fetchmany_value)
result = iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
self.connection.features.empty_fetchmany_value)
else:
result = iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
self.connection.features.empty_fetchmany_value)
if not self.connection.features.can_use_chunked_reads:
# If we are using non-chunked reads, we return the same data
# structure as normally, but ensure it is all read into memory
Expand Down
5 changes: 5 additions & 0 deletions tests/regressiontests/queries/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,11 @@ class Related(models.Model):
... break
True
Bug #7791 -- there were "issues" when ordering and distinct-ing on fields
related via ForeignKeys.
>>> Note.objects.order_by('extrainfo__info').distinct()
[<Note: n3>, <Note: n1>, <Note: n2>]
"""}

# In Python 2.3, exceptions raised in __len__ are swallowed (Python issue
Expand Down

0 comments on commit 83e97ec

Please sign in to comment.