Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12079: Changed has_results to get a single result, thus preven…

…ting exists() from always returning True on backends that support chunked reads.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11654 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c54b8ec2f5122ae13bcb4e1d00d8e8f6bcacf2cf 1 parent 9209025
Karen Tracey authored

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  django/db/models/sql/query.py
3  django/db/models/sql/query.py
@@ -385,7 +385,8 @@ def has_results(self):
385 385
         q.set_extra_mask(('a',))
386 386
         q.set_aggregate_mask(())
387 387
         q.clear_ordering()
388  
-        return bool(q.execute_sql())
  388
+        q.set_limits(high=1)
  389
+        return bool(q.execute_sql(SINGLE))
389 390
 
390 391
     def as_sql(self, with_limits=True, with_col_aliases=False):
391 392
         """

0 notes on commit c54b8ec

Please sign in to comment.
Something went wrong with that request. Please try again.