summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Kelly <ian.g.kelly@gmail.com>2010-09-16 19:56:39 +0000
committerIan Kelly <ian.g.kelly@gmail.com>2010-09-16 19:56:39 +0000
commita63bea3e3baf1d354667cfd8d5ddad09516c24ab (patch)
tree85c9637bd69b612f7111e2e1812ad634b11013a5
parentd443d1606388f2c60add3b050a5da4a8e56e153b (diff)
[1.2.X] Fixed #14244: Allow lists of more than 1000 items to be used with the 'in' lookup in Oracle, by breaking them up into groups of 1000 items and ORing them together. Thanks to rlynch for the report and initial patch. Backport of [13859] from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13860 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/regressiontests/queries/models.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index f3f0ad8857..f22cfb3af3 100644
--- a/tests/regressiontests/queries/models.py
+++ b/tests/regressiontests/queries/models.py
@@ -1339,3 +1339,23 @@ Using an empty generator expression as the rvalue for an "__in" lookup is legal
[]
"""
+
+# Sqlite 3 does not support passing in more than 1000 parameters except by
+# changing a parameter at compilation time.
+if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] != "django.db.backends.sqlite3":
+ __test__["API_TESTS"] += """
+Bug #14244: Test that the "in" lookup works with lists of 1000 items or more.
+>>> Number.objects.all().delete()
+>>> numbers = range(2500)
+>>> for num in numbers:
+... _ = Number.objects.create(num=num)
+>>> Number.objects.filter(num__in=numbers[:1000]).count()
+1000
+>>> Number.objects.filter(num__in=numbers[:1001]).count()
+1001
+>>> Number.objects.filter(num__in=numbers[:2000]).count()
+2000
+>>> Number.objects.filter(num__in=numbers).count()
+2500
+
+"""