summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-08-15 19:05:42 -0400
committerTim Graham <timograham@gmail.com>2015-09-04 07:44:36 -0400
commit233b46f93171d4a7cc279bc3f35e5a99e9a167b8 (patch)
tree2fffde49fc52226c30f726a4942585656506655c /django/db/models/sql
parent7c0850028f25eebaa9b521b5d02afac084ff2c6f (diff)
Fixed #19263 -- Fixed crash when filtering using __in and an empty QuerySet.
Thanks Marcin Biernat for the initial patch and tests.
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/compiler.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index 8b841f6d5e..3f50e951a3 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -484,7 +484,10 @@ class SQLCompiler(object):
if obj.low_mark == 0 and obj.high_mark is None and not self.query.distinct_fields:
# If there is no slicing in use, then we can safely drop all ordering
obj.clear_ordering(True)
- return obj.get_compiler(connection=self.connection).as_sql(subquery=True)
+ nested_sql = obj.get_compiler(connection=self.connection).as_sql(subquery=True)
+ if nested_sql == ('', ()):
+ raise EmptyResultSet
+ return nested_sql
def get_default_columns(self, start_alias=None, opts=None, from_parent=None):
"""