执行以下SQL时,我们遇到无限循环:
SELECT c._COMPTE,
u.CalculatedField,
cl.CHAMPSFCP__VALEUR,
ch_41.CH41__VALEUR,
ch_5.CH5__VALEUR
FROM OmgModel_Z1rP.OMG.dbo.CPARTFCP c
LEFT JOIN BInv6BusinessModel.FREPACCOUNTUNION u
ON u.FREP_AFAINB = c._USERNAME
AND u.CalculatedField6 = 'B'
LEFT JOIN BInv6BusinessModel.ClientTypeCode cl
ON c._COMPTE = cl.CHAMPSFCP__COMPTE
LEFT JOIN (SELECT ch._COMPTE AS CH41__COMPTE,
ch._VALEUR AS CH41__VALEUR
FROM OmgModel_Z1rP.OMG.dbo.CHAMPSFCP ch
WHERE ch._NUMCHAMPS = 41) ch_41
ON c._COMPTE = ch_41.CH41__COMPTE
LEFT JOIN (SELECT ch._COMPTE AS CH5__COMPTE,
ch._VALEUR AS CH5__VALEUR
FROM OmgModel_Z1rP.OMG.dbo.CHAMPSFCP ch
WHERE ch._NUMCHAMPS = 5) ch_5
ON c._COMPTE = ch_5.CH5__COMPTE LIMIT 0, 10
调试后,发现问题出在类RulePlanOuterJoins方法planLeftOuterJoinAssociativityBeforePlanning。
问题来自下面的代码行,如果已删除,则不会重现该问题:
changedAny |= val;