From: stefan Date: Thu, 4 Nov 2010 22:31:39 +0000 (+0000) Subject: fix SQL generation for empty WHERE clause. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;ds=sidebyside;h=6aba791d5b2b532b48d2a746aac958c9cb3bb685;p=roundup.git fix SQL generation for empty WHERE clause. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4571 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/backends/rdbms_common.py b/roundup/backends/rdbms_common.py index 2637f88..ae13ff2 100644 --- a/roundup/backends/rdbms_common.py +++ b/roundup/backends/rdbms_common.py @@ -2230,6 +2230,11 @@ class Class(hyperdb.Class): elif k == 'id': if p.sort_type < 2: if isinstance(v, type([])): + # If there are no permitted values, then the + # where clause will always be false, and we + # can optimize the query away. + if not v: + return [] s = ','.join([a for x in v]) where.append('_%s.%s in (%s)'%(pln, k, s)) args = args + v