-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: fix detection of correlated subqueries in complex filters
Prior to this commit, it was possible for a correlated subquery to go undetected if it was buried in a complex filter. In particular, a filter of the form: <correlated subquery> OR <non-correlated subquery> would incorrectly be marked as *not* containing a correlated subquery. This was because although the logical property HasCorrelatedSubquery was initially set to true upon encountering the first (correlated) subquery, the left-to-right recursive traversal of the OR expression caused HasCorrelatedSubquery to be overwritten to false upon encountering the second (non-correlated) subquery. This commit fixes the issue by never overwriting HasCorrelatedSubquery to false. Fixes #46151 Release note (bug fix): Fixed an internal error that could occur in the optimizer when a WHERE filter contained at least one correlated subquery and one non-correlated subquery. Release justification: This bug fix falls into the category "low risk, high benefit changes to existing functionality".
- Loading branch information
Showing
3 changed files
with
164 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters