-
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 incorrect results returned by non-recursive WITH RECURSIVE CTE
Prior to this commit, queries that used a CTE marked as WITH RECURSIVE which did not reference itself (i.e., it was not actually recursive) could return incorrect results. This was because the UNION ALL in the CTE was incorrectly converted to a UNION by the optimizer. This commit fixes the problem by ensuring that UNION ALL is used if the original CTE contained UNION ALL. Fixes #93370 Release note (bug fix): Fixed a bug in which CTEs marked as WITH RECURSIVE which were not actually recursive could return incorrect results. This could happen if the CTE used a UNION ALL, because the optimizer incorrectly converted the UNION ALL to a UNION. This bug has existed since suppport for recursive CTEs was first added in v20.1, and has now been fixed.
- Loading branch information
Showing
4 changed files
with
182 additions
and
2 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
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