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

Proposed by William Grant on 2012-09-11
Status: Merged
Merged at revision: 15932
Proposed branch: lp:~wgrant/launchpad/bug-1046713
Merge into: lp:launchpad
Diff against target: 39 lines (+35/-0)
1 file modified
database/schema/patch-2209-32-0.sql (+35/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/bug-1046713
Reviewer Review Type Date Requested Status
Stuart Bishop db 2012-09-11 Approve on 2012-09-11
Robert Collins db 2012-09-11 Pending
Review via email: mp+123668@code.launchpad.net

Commit Message

Fix typo in bug_summary_dec which meant that a change to an access policy row changed matching rows for other access policies too.

Description of the Change

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.

To post a comment you must log in.
Stuart Bishop (stub) :
review: Approve (db)
Stuart Bishop (stub) wrote :

applied to qastaging and production

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-32-0.sql'
2--- database/schema/patch-2209-32-0.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-32-0.sql 2012-09-11 01:00:36 +0000
4@@ -0,0 +1,35 @@
5+-- Copyright 2012 Canonical Ltd. This software is licensed under the
6+-- GNU Affero General Public License version 3 (see the file LICENSE).
7+SET client_min_messages=ERROR;
8+
9+CREATE OR REPLACE FUNCTION public.bug_summary_dec(bugsummary)
10+ RETURNS void
11+ LANGUAGE sql
12+AS $function$
13+ -- We own the row reference, so in the absence of bugs this cannot
14+ -- fail - just decrement the row.
15+ UPDATE BugSummary SET count = count + $1.count
16+ WHERE
17+ ((product IS NULL AND $1.product IS NULL)
18+ OR product = $1.product)
19+ AND ((productseries IS NULL AND $1.productseries IS NULL)
20+ OR productseries = $1.productseries)
21+ AND ((distribution IS NULL AND $1.distribution IS NULL)
22+ OR distribution = $1.distribution)
23+ AND ((distroseries IS NULL AND $1.distroseries IS NULL)
24+ OR distroseries = $1.distroseries)
25+ AND ((sourcepackagename IS NULL AND $1.sourcepackagename IS NULL)
26+ OR sourcepackagename = $1.sourcepackagename)
27+ AND ((viewed_by IS NULL AND $1.viewed_by IS NULL)
28+ OR viewed_by = $1.viewed_by)
29+ AND ((tag IS NULL AND $1.tag IS NULL)
30+ OR tag = $1.tag)
31+ AND status = $1.status
32+ AND ((milestone IS NULL AND $1.milestone IS NULL)
33+ OR milestone = $1.milestone)
34+ AND importance = $1.importance
35+ AND has_patch = $1.has_patch
36+ AND access_policy IS NOT DISTINCT FROM $1.access_policy;
37+$function$;
38+
39+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 32, 0);