From 44e29ea1e906859e85bb2a46ae5ea9d82bd96f5f Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 13 Jun 2017 08:16:16 +0200 Subject: [1.11.x] Fixed #28293 -- Fixed union(), intersection(), and difference() when combining with an EmptyQuerySet. Thanks Jon Dufresne for the report and Tim Graham for the review. Backport of 82175ead723f8fa3f9271fbd4b24275097029aab from master --- django/db/models/sql/compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/db/models/sql/compiler.py') diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 9acb56aa84..d1373fcf95 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -379,7 +379,7 @@ class SQLCompiler(object): features = self.connection.features compilers = [ query.get_compiler(self.using, self.connection) - for query in self.query.combined_queries + for query in self.query.combined_queries if not query.is_empty() ] if not features.supports_slicing_ordering_in_compound: for query, compiler in zip(self.query.combined_queries, compilers): -- cgit v1.3