From 6aba791d5b2b532b48d2a746aac958c9cb3bb685 Mon Sep 17 00:00:00 2001 From: stefan Date: Thu, 4 Nov 2010 22:31:39 +0000 Subject: [PATCH] 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 --- roundup/backends/rdbms_common.py | 5 +++++ 1 file changed, 5 insertions(+) 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 -- 2.30.2