From 816eae35084a69a76e45439df20f69c7e0ccaef9 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 13 Oct 2016 12:12:58 -0400 Subject: [PATCH] Removed unused EmptyResultSets in SQLCompilers. Unused since ed1bcf05158acf4bf4e0189d477b6c762bd0133e. --- django/db/models/sql/compiler.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 51c3d6e661..e7ccba6151 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -482,10 +482,7 @@ class SQLCompiler(object): not self.query.distinct_fields and not self.query.select_for_update): obj.clear_ordering(True) - nested_sql = obj.get_compiler(connection=self.connection).as_sql(subquery=True) - if nested_sql == ('', ()): - raise EmptyResultSet - return nested_sql + return obj.get_compiler(connection=self.connection).as_sql(subquery=True) def get_default_columns(self, start_alias=None, opts=None, from_parent=None): """ @@ -1221,11 +1218,6 @@ class SQLAggregateCompiler(SQLCompiler): Creates the SQL for this query. Returns the SQL string and list of parameters. """ - # Empty SQL for the inner query is a marker that the inner query - # isn't going to produce any results. This can happen when doing - # LIMIT 0 queries (generated by qs[:0]) for example. - if not self.query.subquery: - raise EmptyResultSet sql, params = [], [] for annotation in self.query.annotation_select.values(): ann_sql, ann_params = self.compile(annotation, select_format=True)