mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Analyzer: Forbid WINDOW redefinition
This commit is contained in:
parent
35d96f98f4
commit
2458defd01
@ -8009,7 +8009,12 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
window_node_typed.setParentWindowName({});
|
||||
}
|
||||
|
||||
scope.window_name_to_window_node.emplace(window_node_typed.getAlias(), window_node);
|
||||
auto [_, inserted] = scope.window_name_to_window_node.emplace(window_node_typed.getAlias(), window_node);
|
||||
if (!inserted)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS,
|
||||
"Window '{}' is already defined. In scope {}",
|
||||
window_node_typed.getAlias(),
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
}
|
||||
|
||||
/** Disable identifier cache during JOIN TREE resolve.
|
||||
|
@ -0,0 +1,8 @@
|
||||
CREATE TABLE users (uid Int16, name String, age Int16) ENGINE=MergeTree ORDER BY tuple();
|
||||
|
||||
INSERT INTO users VALUES (1231, 'John', 33);
|
||||
INSERT INTO users VALUES (6666, 'Ksenia', 48);
|
||||
INSERT INTO users VALUES (8888, 'Alice', 50);
|
||||
|
||||
SELECT count(*) OVER w
|
||||
FROM users WINDOW w AS (ORDER BY uid), w AS(ORDER BY name); -- { serverError BAD_ARGUMENTS }
|
Loading…
Reference in New Issue
Block a user