Skip to content

Commit a63bea3

Browse files
[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
1 parent d443d16 commit a63bea3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/regressiontests/queries/models.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,3 +1339,23 @@ def __unicode__(self):
13391339
[]
13401340
13411341
"""
1342+
1343+
# Sqlite 3 does not support passing in more than 1000 parameters except by
1344+
# changing a parameter at compilation time.
1345+
if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] != "django.db.backends.sqlite3":
1346+
__test__["API_TESTS"] += """
1347+
Bug #14244: Test that the "in" lookup works with lists of 1000 items or more.
1348+
>>> Number.objects.all().delete()
1349+
>>> numbers = range(2500)
1350+
>>> for num in numbers:
1351+
... _ = Number.objects.create(num=num)
1352+
>>> Number.objects.filter(num__in=numbers[:1000]).count()
1353+
1000
1354+
>>> Number.objects.filter(num__in=numbers[:1001]).count()
1355+
1001
1356+
>>> Number.objects.filter(num__in=numbers[:2000]).count()
1357+
2000
1358+
>>> Number.objects.filter(num__in=numbers).count()
1359+
2500
1360+
1361+
"""

0 commit comments

Comments
 (0)