mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
fix not equi join on issue
This commit is contained in:
parent
eb986b8732
commit
0fa4c37e85
@ -127,6 +127,12 @@ std::pair<size_t, size_t> CollectJoinOnKeysMatcher::getTableNumbers(const ASTPtr
|
||||
getIdentifiers(left_ast, left_identifiers);
|
||||
getIdentifiers(right_ast, right_identifiers);
|
||||
|
||||
if (left_identifiers.empty() || right_identifiers.empty())
|
||||
{
|
||||
throw Exception("Not equi-join ON expression: " + queryToString(expr) + ". No columns in one of equality side.",
|
||||
ErrorCodes::INVALID_JOIN_ON_EXPRESSION);
|
||||
}
|
||||
|
||||
size_t left_idents_table = getTableForIdentifiers(left_identifiers, data);
|
||||
size_t right_idents_table = getTableForIdentifiers(right_identifiers, data);
|
||||
|
||||
|
7
tests/queries/0_stateless/01478_not_equi-join_on.sql
Normal file
7
tests/queries/0_stateless/01478_not_equi-join_on.sql
Normal file
@ -0,0 +1,7 @@
|
||||
SELECT * FROM (SELECT NULL AS a, 1 AS b) AS foo
|
||||
RIGHT JOIN (SELECT 1024 AS b) AS bar
|
||||
ON 1 = foo.b; -- { serverError 403 }
|
||||
|
||||
SELECT * FROM (SELECT NULL AS a, 1 AS b) AS foo
|
||||
RIGHT JOIN (SELECT 1024 AS b) AS bar
|
||||
ON 1 = bar.b; -- { serverError 403 }
|
Loading…
Reference in New Issue
Block a user