SELECT
POMsgId.msgid AS msgid,
POMsgID_Plural.msgid AS msgid_plural,
context,
date_reviewed,
is_current,
is_imported,
pt0.translation AS translation0,
pt1.translation AS translation1,
pt2.translation AS translation2,
pt3.translation AS translation3,
pt4.translation AS translation4,
pt5.translation AS translation5
FROM POTMsgSet
JOIN TranslationTemplateItem ON
TranslationTemplateItem.potmsgset=POTMsgSet.id
JOIN POTemplate ON
POTemplate.id=TranslationTemplateItem.potemplate
JOIN POFile ON
POFile.potemplate=POTemplate.id AND
POFile.id=%(pofile)s
JOIN TranslationMessage ON
POTMsgSet.id=TranslationMessage.potmsgset AND
(TranslationMessage.potemplate=POTemplate.id OR
TranslationMessage.potemplate IS NULL) AND
POFile.language=TranslationMessage.language AND
POFile.variant IS NOT DISTINCT FROM TranslationMessage.variant
LEFT OUTER JOIN POTranslation pt0 ON pt0.id = TranslationMessage.msgstr0
LEFT OUTER JOIN POTranslation pt1 ON pt1.id = TranslationMessage.msgstr1
LEFT OUTER JOIN POTranslation pt2 ON pt2.id = TranslationMessage.msgstr2
LEFT OUTER JOIN POTranslation pt3 ON pt3.id = TranslationMessage.msgstr3
LEFT OUTER JOIN POTranslation pt4 ON pt4.id = TranslationMessage.msgstr4
LEFT OUTER JOIN POTranslation pt5 ON pt5.id = TranslationMessage.msgstr5
JOIN POMsgID ON
POMsgID.id=POTMsgSet.msgid_singular
LEFT OUTER JOIN POMsgID AS POMsgID_Plural ON
POMsgID_Plural.id=POTMsgSet.msgid_plural
WHERE (is_current IS TRUE OR is_imported IS TRUE)
ORDER BY
TranslationTemplateItem.sequence,
TranslationMessage.potemplate NULLS LAST
Here's what the query would look like:
SELECT Plural. msgid AS msgid_plural, lateItem ON TemplateItem. potmsgset= POTMsgSet. id id=TranslationT emplateItem. potemplate potemplate= POTemplate. id AND id=%(pofile) s id=TranslationM essage. potmsgset AND nMessage. potemplate= POTemplate. id OR nMessage. potemplate IS NULL) AND language= TranslationMess age.language AND age.variant age.msgstr0 age.msgstr1 age.msgstr2 age.msgstr3 age.msgstr4 age.msgstr5 id=POTMsgSet. msgid_singular Plural. id=POTMsgSet. msgid_plural TemplateItem. sequence, Message. potemplate NULLS LAST
POMsgId.msgid AS msgid,
POMsgID_
context,
date_reviewed,
is_current,
is_imported,
pt0.translation AS translation0,
pt1.translation AS translation1,
pt2.translation AS translation2,
pt3.translation AS translation3,
pt4.translation AS translation4,
pt5.translation AS translation5
FROM POTMsgSet
JOIN TranslationTemp
Translation
JOIN POTemplate ON
POTemplate.
JOIN POFile ON
POFile.
POFile.
JOIN TranslationMessage ON
POTMsgSet.
(Translatio
Translatio
POFile.
POFile.variant IS NOT DISTINCT FROM TranslationMess
LEFT OUTER JOIN POTranslation pt0 ON pt0.id = TranslationMess
LEFT OUTER JOIN POTranslation pt1 ON pt1.id = TranslationMess
LEFT OUTER JOIN POTranslation pt2 ON pt2.id = TranslationMess
LEFT OUTER JOIN POTranslation pt3 ON pt3.id = TranslationMess
LEFT OUTER JOIN POTranslation pt4 ON pt4.id = TranslationMess
LEFT OUTER JOIN POTranslation pt5 ON pt5.id = TranslationMess
JOIN POMsgID ON
POMsgID.
LEFT OUTER JOIN POMsgID AS POMsgID_Plural ON
POMsgID_
WHERE (is_current IS TRUE OR is_imported IS TRUE)
ORDER BY
Translation
Translation