summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/compiler.py2
-rw-r--r--django/db/models/sql/query.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index a018517b89..47a85bb9a4 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -367,8 +367,6 @@ class SQLCompiler(object):
refcounts_before = self.query.alias_refcount.copy()
try:
extra_select, order_by, group_by = self.pre_sql_setup()
- if with_limits and self.query.low_mark == self.query.high_mark:
- return '', ()
distinct_fields = self.get_distinct()
# This must come after 'select', 'ordering', and 'distinct' -- see
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 0686bf8875..f9df41392b 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1550,6 +1550,9 @@ class Query(object):
else:
self.low_mark = self.low_mark + low
+ if self.low_mark == self.high_mark:
+ self.set_empty()
+
def clear_limits(self):
"""
Clears any existing limits.