From: mkanat%kerio.com <> Date: Thu, 17 Mar 2005 14:50:44 +0000 (+0000) Subject: Bug 284125: PostgreSQL cannot call SUM on a boolean (Boolean Charts) X-Git-Tag: bugzilla-2.19.3~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c70ff10412b775ad58e074508836c2fc1aa760bb;p=thirdparty%2Fbugzilla.git Bug 284125: PostgreSQL cannot call SUM on a boolean (Boolean Charts) Patch By Tomas Kopal r=mkanat, a=justdave --- diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 3aba68ad9b..1f8e53ea34 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -812,8 +812,8 @@ sub init { # If the numbers are the same, all flags match the condition, # so this bug should be included. if ($t =~ m/not/) { - push(@fields, "SUM($ff IS NOT NULL) AS allflags_$chartid"); - push(@fields, "SUM($term) AS matchingflags_$chartid"); + push(@fields, "SUM(CASE WHEN $ff IS NOT NULL THEN 1 ELSE 0 END) AS allflags_$chartid"); + push(@fields, "SUM(CASE WHEN $term THEN 1 ELSE 0 END) AS matchingflags_$chartid"); push(@having, "allflags_$chartid = matchingflags_$chartid"); $term = "0=0"; }