← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/bug-1046713 into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/bug-1046713 into lp:launchpad.

Requested reviews:
  Robert Collins (lifeless): db
  Stuart Bishop (stub): db
Related bugs:
  Bug #1046713 in Launchpad itself: "Bug counts 1 or 2 less than they should be"
  https://bugs.launchpad.net/launchpad/+bug/1046713

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-1046713/+merge/123668

This branch fixes a typo in the bug_summary_dec SQL function, which caused it to apply deltas for any access policy to all access policies. This causes bugsummary counts to drift for multi-task bugs, or when changing from one private information type to another.

http://bazaar.launchpad.net/~wgrant/launchpad/bug-1046713/revision/15927 is the diff from the old function. This should be applied live.
-- 
https://code.launchpad.net/~wgrant/launchpad/bug-1046713/+merge/123668
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== added file 'database/schema/patch-2209-32-0.sql'
--- database/schema/patch-2209-32-0.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-32-0.sql	2012-09-11 01:00:36 +0000
@@ -0,0 +1,35 @@
+-- Copyright 2012 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+SET client_min_messages=ERROR;
+
+CREATE OR REPLACE FUNCTION public.bug_summary_dec(bugsummary)
+ RETURNS void
+ LANGUAGE sql
+AS $function$
+    -- We own the row reference, so in the absence of bugs this cannot
+    -- fail - just decrement the row.
+    UPDATE BugSummary SET count = count + $1.count
+    WHERE
+        ((product IS NULL AND $1.product IS NULL)
+            OR product = $1.product)
+        AND ((productseries IS NULL AND $1.productseries IS NULL)
+            OR productseries = $1.productseries)
+        AND ((distribution IS NULL AND $1.distribution IS NULL)
+            OR distribution = $1.distribution)
+        AND ((distroseries IS NULL AND $1.distroseries IS NULL)
+            OR distroseries = $1.distroseries)
+        AND ((sourcepackagename IS NULL AND $1.sourcepackagename IS NULL)
+            OR sourcepackagename = $1.sourcepackagename)
+        AND ((viewed_by IS NULL AND $1.viewed_by IS NULL)
+            OR viewed_by = $1.viewed_by)
+        AND ((tag IS NULL AND $1.tag IS NULL)
+            OR tag = $1.tag)
+        AND status = $1.status
+        AND ((milestone IS NULL AND $1.milestone IS NULL)
+            OR milestone = $1.milestone)
+        AND importance = $1.importance
+        AND has_patch = $1.has_patch
+        AND access_policy IS NOT DISTINCT FROM $1.access_policy;
+$function$;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 32, 0);


Follow ups