Skip to content

Commit ffe3ccd

Browse files
Add one more check.
1 parent 0072eb9 commit ffe3ccd

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Analyzer/Resolve/QueryAnalyzer.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5176,6 +5176,16 @@ void QueryAnalyzer::resolveJoin(QueryTreeNodePtr & join_node, IdentifierResolveS
51765176
resolveQueryJoinTreeNode(join_node_typed.getRightTableExpression(), scope, expressions_visitor);
51775177
validateJoinTableExpressionWithoutAlias(join_node, join_node_typed.getRightTableExpression(), scope);
51785178

5179+
if (isCorrelatedQueryOrUnionNode(join_node_typed.getLeftTableExpression()))
5180+
throw Exception(ErrorCodes::NOT_IMPLEMENTED,
5181+
"Correlated subqueries are not supported in JOINs yet, but found in expression: {}",
5182+
join_node_typed.getLeftTableExpression()->formatASTForErrorMessage());
5183+
5184+
if (isCorrelatedQueryOrUnionNode(join_node_typed.getRightTableExpression()))
5185+
throw Exception(ErrorCodes::NOT_IMPLEMENTED,
5186+
"Correlated subqueries are not supported in JOINs yet, but found in expression: {}",
5187+
join_node_typed.getRightTableExpression()->formatASTForErrorMessage());
5188+
51795189
if (!join_node_typed.getLeftTableExpression()->hasAlias() && !join_node_typed.getRightTableExpression()->hasAlias())
51805190
checkDuplicateTableNamesOrAliasForPasteJoin(join_node_typed, scope);
51815191

tests/queries/0_stateless/03412_analyzer_correlated_subquery_bug.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ WHERE length(arrayFilter(x -> (x OR exists((
2828
FROM numbers(1)
2929
WHERE number >= tbl.number
3030
))), range(number))) > 0;
31+
32+
SELECT number FROM mem2 AS tbl INNER JOIN (SELECT number FROM numbers(1) WHERE tbl.number >= number) AS alias4 ON alias4.number = number; -- { serverError NOT_IMPLEMENTED}

0 commit comments

Comments
 (0)