summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-03-20 10:37:57 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-03-20 10:37:57 +0000
commit9f6a82fafbd84865a06e162c14b6a5d5e110babe (patch)
tree1cde51216f8f848867ec52b496be5e1a142d3ec3 /tests
parentd58020fce8019e3a9df717e0a78a9833c85094b7 (diff)
Fixed #13156 -- Ensure that exists() queries are as fast as they can be. Thanks to Jerome Leclanche for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12810 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/queries/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index 43c843756c..06c4524d9d 100644
--- a/tests/regressiontests/queries/models.py
+++ b/tests/regressiontests/queries/models.py
@@ -277,6 +277,16 @@ class Plaything(models.Model):
__test__ = {'API_TESTS':"""
+>>> # Regression for #13156 -- exists() queries have minimal SQL
+>>> from django.db import connection
+>>> settings.DEBUG = True
+>>> Tag.objects.exists()
+False
+>>> # Ok - so the exist query worked - but did it include too many columns?
+>>> "id" not in connection.queries[-1]['sql'] and "name" not in connection.queries[-1]['sql']
+True
+>>> settings.DEBUG = False
+
>>> generic = NamedCategory.objects.create(name="Generic")
>>> t1 = Tag.objects.create(name='t1', category=generic)
>>> t2 = Tag.objects.create(name='t2', parent=t1, category=generic)