]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 284125: PostgreSQL cannot call SUM on a boolean (Boolean Charts)
authormkanat%kerio.com <>
Thu, 17 Mar 2005 14:50:44 +0000 (14:50 +0000)
committermkanat%kerio.com <>
Thu, 17 Mar 2005 14:50:44 +0000 (14:50 +0000)
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=mkanat, a=justdave

Bugzilla/Search.pm

index 3aba68ad9ba1001b847b74173fc8b5b05b46bd1b..1f8e53ea34936616a4315d0f92c554052d8586b3 100644 (file)
@@ -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";
              }