From 08d14925c9e321d7ff4e0f6c1983a74606aa1941 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Wed, 13 Oct 2010 23:36:16 +0000 Subject: Fixed #12192 -- Don't execute any DB query when the QS slicing being performed will result in use of LIMIT 0. Thanks Suor for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14204 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/sql/compiler.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'django/db/models/sql') diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index eaf2cd2569..a11d556b38 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -52,6 +52,9 @@ class SQLCompiler(object): If 'with_limits' is False, any limit/offset information is not included in the query. """ + if with_limits and self.query.low_mark == self.query.high_mark: + return '', () + self.pre_sql_setup() out_cols = self.get_columns(with_col_aliases) ordering, ordering_group_by = self.get_ordering() -- cgit v1.3