Query: SubQueryMemberPushDown optimization is too aggressive, which may lead to invalid sql or data corruption #8505
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
Part of QM optimization is SubQueryMemberPushDownExpressionVisitor, which pushes down member from outside subquery into it. This way we get much simpler QMs and are able to translate more queries fully to sql. Problem is that we are doing it too aggresively, e.g. query:
with the following QM (before optimization):
will get "optimized" to:
which is wrong. This produces invalid sql, but even if the sql would be valid, results would be incorrect - Distinct is now applied on the Name, rather than entity itself, which will produce unexpected results if the Name has duplicated values
We should not perform the pushdown if Distinct is present in the subquery ( other operators also? Intersect, Except, Union)
The text was updated successfully, but these errors were encountered: