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

Proposed by William Grant
Status: Merged
Merged at revision: 17368
Proposed branch: lp:~wgrant/launchpad/tm-performance--1-disambiguate
Merge into: lp:launchpad
Diff against target: 34 lines (+3/-3)
2 files modified
lib/lp/translations/model/pofile.py (+2/-2)
lib/lp/translations/model/potmsgset.py (+1/-1)
To merge this branch: bzr merge lp:~wgrant/launchpad/tm-performance--1-disambiguate
Reviewer Review Type Date Requested Status
Colin Watson (community) code Approve
Review via email: mp+251206@code.launchpad.net

Commit message

Disambiguate POTMsgSet.msgid_* references in queries that involve TM.

Description of the change

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

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/model/pofile.py'
2--- lib/lp/translations/model/pofile.py 2013-06-20 05:50:00 +0000
3+++ lib/lp/translations/model/pofile.py 2015-02-27 05:52:23 +0000
4@@ -225,7 +225,7 @@
5 POTMsgSet.msgid_singular IN (
6 SELECT POMsgID.id FROM POMsgID
7 WHERE id IN (
8- SELECT DISTINCT(msgid_singular)
9+ SELECT DISTINCT(POTMsgSet.msgid_singular)
10 FROM POTMsgSet
11 JOIN TranslationTemplateItem
12 ON TranslationTemplateItem.potmsgset = POTMsgSet.id
13@@ -246,7 +246,7 @@
14 POTMsgSet.msgid_plural IN (
15 SELECT POMsgID.id FROM POMsgID
16 WHERE id IN (
17- SELECT DISTINCT(msgid_plural)
18+ SELECT DISTINCT(POTMsgSet.msgid_plural)
19 FROM POTMsgSet
20 JOIN TranslationTemplateItem
21 ON TranslationTemplateItem.potmsgset = POTMsgSet.id
22
23=== modified file 'lib/lp/translations/model/potmsgset.py'
24--- lib/lp/translations/model/potmsgset.py 2013-06-20 05:50:00 +0000
25+++ lib/lp/translations/model/potmsgset.py 2015-02-27 05:52:23 +0000
26@@ -414,7 +414,7 @@
27 JOIN SuggestivePOTemplate ON
28 TranslationTemplateItem.potemplate =
29 SuggestivePOTemplate.potemplate
30- WHERE msgid_singular = %s and potmsgset.id <> %s
31+ WHERE POTMsgSet.msgid_singular = %s and POTMsgSet.id <> %s
32 )''' % sqlvalues(self.msgid_singular, self))
33
34 # Subquery to find the ids of TranslationMessages that are