mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Using querysets as an rvalue in filter() calls was causing an unnecessary
database query, due to a bool() call. This change stops that behaviour. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1015,6 +1015,13 @@ performance problems on backends like MySQL.
|
||||
>>> Annotation.objects.filter(notes__in=Note.objects.filter(note="n1"))
|
||||
[<Annotation: a1>]
|
||||
|
||||
Nested queries should not evaluate the inner query as part of constructing the
|
||||
SQL. This test verifies this: if the inner query is evaluated, the outer "in"
|
||||
lookup will raise an EmptyResultSet exception (as the inner query returns
|
||||
nothing).
|
||||
>>> print Annotation.objects.filter(notes__in=Note.objects.filter(note="xyzzy")).query
|
||||
SELECT ...
|
||||
|
||||
"""}
|
||||
|
||||
# In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__
|
||||
|
||||
Reference in New Issue
Block a user