summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorJohannes Dollinger <emulbreh@googlemail.com>2016-08-05 09:09:01 -0400
committerTim Graham <timograham@gmail.com>2016-08-08 10:43:33 -0400
commitc002a0d39f18694f5e8a07d86684fc793b063056 (patch)
tree8a6395bed9010d501783cdf1d65cf7b59f7079fc /django/db/models/sql
parent1410616e0e2637e4b0821620202bf62edc903b88 (diff)
Fixed #26517 -- Fixed ExpressionWrapper with empty queryset.
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/compiler.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index 9447f06f85..0b7f9e20cb 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -223,7 +223,12 @@ class SQLCompiler(object):
ret = []
for col, alias in select:
- ret.append((col, self.compile(col, select_format=True), alias))
+ try:
+ sql, params = self.compile(col, select_format=True)
+ except EmptyResultSet:
+ # Select a predicate that's always False.
+ sql, params = '0', ()
+ ret.append((col, (sql, params), alias))
return ret, klass_info, annotations
def get_order_by(self):