← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/denorm-bspph-qualified into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/denorm-bspph-qualified into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/denorm-bspph-qualified/+merge/71812

Fix two queries to use SourcePackageRelease.sourcepackagename explicitly.
-- 
https://code.launchpad.net/~stevenk/launchpad/denorm-bspph-qualified/+merge/71812
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/denorm-bspph-qualified into lp:launchpad.
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py	2011-08-11 05:07:38 +0000
+++ lib/lp/bugs/model/bugtask.py	2011-08-17 05:27:59 +0000
@@ -2071,8 +2071,9 @@
                 archive.id
                 for archive in distroseries.distribution.all_distro_archives]
             with_clauses.append("""spns as (
-                SELECT sourcepackagename from SourcePackagePublishingHistory
-                JOIN SourcePackageRelease on SourcePackageRelease.id =
+                SELECT spr.sourcepackagename from
+                SourcePackagePublishingHistory
+                JOIN SourcePackageRelease as spr on spr.id =
                     SourcePackagePublishingHistory.sourcepackagerelease AND
                 SourcePackagePublishingHistory.distroseries = %s AND
                 SourcePackagePublishingHistory.archive IN %s AND

=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py	2011-08-11 20:37:16 +0000
+++ lib/lp/registry/model/person.py	2011-08-17 05:27:59 +0000
@@ -2617,16 +2617,18 @@
         query_clauses = " AND ".join(clauses)
         query = """
             SourcePackageRelease.id IN (
-                SELECT DISTINCT ON (upload_distroseries, sourcepackagename,
+                SELECT DISTINCT ON (upload_distroseries,
+                                    sourcepackagerelease.sourcepackagename,
                                     upload_archive)
                     sourcepackagerelease.id
                 FROM sourcepackagerelease, archive,
-                    sourcepackagepublishinghistory sspph
+                    sourcepackagepublishinghistory as spph
                 WHERE
-                    sspph.sourcepackagerelease = sourcepackagerelease.id AND
-                    sspph.archive = archive.id AND
+                    spph.sourcepackagerelease = sourcepackagerelease.id AND
+                    spph.archive = archive.id AND
                     %(more_query_clauses)s
-                ORDER BY upload_distroseries, sourcepackagename,
+                ORDER BY upload_distroseries,
+                    sourcepackagerelease.sourcepackagename,
                     upload_archive, dateuploaded DESC
               )
               """ % dict(more_query_clauses=query_clauses)