← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/tm-performance--1-disambiguate into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/tm-performance--1-disambiguate into lp:launchpad.

Commit message:
Disambiguate POTMsgSet.msgid_* references in queries that involve TM.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/tm-performance--1-disambiguate/+merge/251206

Disambiguate POTMsgSet.msgid_* references in queries that involve TranslationMessage, as it will soon grow denormalised copies of msgid_singular and msgid_plural.

-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/tm-performance--1-disambiguate into lp:launchpad.
=== modified file 'lib/lp/translations/model/pofile.py'
--- lib/lp/translations/model/pofile.py	2013-06-20 05:50:00 +0000
+++ lib/lp/translations/model/pofile.py	2015-02-27 05:52:23 +0000
@@ -225,7 +225,7 @@
                POTMsgSet.msgid_singular IN (
                  SELECT POMsgID.id FROM POMsgID
                    WHERE id IN (
-                     SELECT DISTINCT(msgid_singular)
+                     SELECT DISTINCT(POTMsgSet.msgid_singular)
                        FROM POTMsgSet
                        JOIN TranslationTemplateItem
                          ON TranslationTemplateItem.potmsgset = POTMsgSet.id
@@ -246,7 +246,7 @@
                POTMsgSet.msgid_plural IN (
                  SELECT POMsgID.id FROM POMsgID
                    WHERE id IN (
-                     SELECT DISTINCT(msgid_plural)
+                     SELECT DISTINCT(POTMsgSet.msgid_plural)
                        FROM POTMsgSet
                        JOIN TranslationTemplateItem
                          ON TranslationTemplateItem.potmsgset = POTMsgSet.id

=== modified file 'lib/lp/translations/model/potmsgset.py'
--- lib/lp/translations/model/potmsgset.py	2013-06-20 05:50:00 +0000
+++ lib/lp/translations/model/potmsgset.py	2015-02-27 05:52:23 +0000
@@ -414,7 +414,7 @@
                 JOIN SuggestivePOTemplate ON
                     TranslationTemplateItem.potemplate =
                         SuggestivePOTemplate.potemplate
-                WHERE msgid_singular = %s and potmsgset.id <> %s
+                WHERE POTMsgSet.msgid_singular = %s and POTMsgSet.id <> %s
             )''' % sqlvalues(self.msgid_singular, self))
 
         # Subquery to find the ids of TranslationMessages that are


Follow ups