Skip to content

Commit

Permalink
QueryNormalizer only checks stack size
Browse files Browse the repository at this point in the history
  • Loading branch information
vdimir committed Oct 16, 2023
1 parent ba5cd01 commit d7c7742
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions src/Interpreters/QueryNormalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ void QueryNormalizer::visit(ASTIdentifier & node, ASTPtr & ast, Data & data)
/// In a construct like "a AS b", where a is an alias, you must set alias b to the result of substituting alias a.
/// Check size of the alias before cloning too large alias AST
alias_node->checkSize(data.settings.max_expanded_ast_elements);
current_asts.insert(alias_node.get());
ast = alias_node->clone();
ast->setAlias(node_alias);

Expand All @@ -139,7 +138,6 @@ void QueryNormalizer::visit(ASTIdentifier & node, ASTPtr & ast, Data & data)
/// Check size of the alias before cloning too large alias AST
alias_node->checkSize(data.settings.max_expanded_ast_elements);
auto alias_name = ast->getAliasOrColumnName();
current_asts.insert(alias_node.get());
ast = alias_node->clone();
ast->setAlias(alias_name);

Expand Down
2 changes: 1 addition & 1 deletion tests/queries/0_stateless/02896_cyclic_aliases_crash.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SELECT
val + 1 as prev,
val + prev as val
FROM ( SELECT 1 as val )
; -- { serverError CYCLIC_ALIASES }
; -- { serverError CYCLIC_ALIASES, TOO_DEEP_RECURSION }


SELECT
Expand Down

0 comments on commit d7c7742

Please sign in to comment.