← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:db-xpr-version-text into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:db-xpr-version-text into launchpad:master.

Commit message:
Index xPR (xPN, version::text)

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers): db

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/389596

This is needed to allow efficient lookups of binary and source package releases by exactly matching the text of their version strings rather than doing debversion-type comparisons (for example, 0.1-1 and 0.01-1 are equal according to debversion).

This should be applied as a hot patch using CONCURRENTLY.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:db-xpr-version-text into launchpad:master.
diff --git a/database/schema/patch-2210-21-0.sql b/database/schema/patch-2210-21-0.sql
new file mode 100644
index 0000000..a611de4
--- /dev/null
+++ b/database/schema/patch-2210-21-0.sql
@@ -0,0 +1,11 @@
+-- Copyright 2020 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 INDEX binarypackagerelease__binarypackagename__version_text__idx
+    ON BinaryPackageRelease (binarypackagename, (version::text));
+CREATE INDEX sourcepackagerelease__sourcepackagename__version_text__idx
+    ON SourcePackageRelease (sourcepackagename, (version::text));
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 21, 0);

Follow ups