diff --git a/src/Interpreters/GlobalSubqueriesVisitor.h b/src/Interpreters/GlobalSubqueriesVisitor.h index 4df9da14651..7e163999d91 100644 --- a/src/Interpreters/GlobalSubqueriesVisitor.h +++ b/src/Interpreters/GlobalSubqueriesVisitor.h @@ -57,7 +57,7 @@ public: return; bool is_table = false; - ASTPtr subquery_or_table_name = ast; /// ASTIdentifier | ASTSubquery | ASTTableExpression + ASTPtr subquery_or_table_name = ast; /// ASTTableIdentifier | ASTSubquery | ASTTableExpression if (const auto * ast_table_expr = ast->as()) { @@ -69,7 +69,7 @@ public: is_table = true; } } - else if (ast->as()) + else if (ast->as()) is_table = true; if (!subquery_or_table_name) diff --git a/src/Interpreters/IdentifierSemantic.cpp b/src/Interpreters/IdentifierSemantic.cpp index 034930c2eec..b440bb16703 100644 --- a/src/Interpreters/IdentifierSemantic.cpp +++ b/src/Interpreters/IdentifierSemantic.cpp @@ -8,7 +8,6 @@ namespace DB namespace ErrorCodes { - extern const int SYNTAX_ERROR; extern const int AMBIGUOUS_COLUMN_NAME; } diff --git a/src/Interpreters/MarkTableIdentifiersVisitor.cpp b/src/Interpreters/MarkTableIdentifiersVisitor.cpp index d77941e476d..8448b86a83d 100644 --- a/src/Interpreters/MarkTableIdentifiersVisitor.cpp +++ b/src/Interpreters/MarkTableIdentifiersVisitor.cpp @@ -32,7 +32,7 @@ void MarkTableIdentifiersMatcher::visit(const ASTFunction & func, ASTPtr & ptr, { auto ast = func.arguments->children.at(1); auto opt_name = tryGetIdentifierName(ast); - if (opt_name && !data.aliases.count(*opt_name)) + if (opt_name && !data.aliases.count(*opt_name) && ast->as()) { ptr = func.clone(); ptr->as()->arguments->children[1] = ast->as()->createTable(); @@ -48,7 +48,7 @@ void MarkTableIdentifiersMatcher::visit(const ASTFunction & func, ASTPtr & ptr, return; auto & ast = func.arguments->children.at(0); auto opt_name = tryGetIdentifierName(ast); - if (opt_name && !data.aliases.count(*opt_name)) + if (opt_name && !data.aliases.count(*opt_name) && ast->as()) { ptr = func.clone(); ptr->as()->arguments->children[0] = ast->as()->createTable(); diff --git a/src/Parsers/ASTIdentifier.cpp b/src/Parsers/ASTIdentifier.cpp index 7b4270f875d..739c35a0501 100644 --- a/src/Parsers/ASTIdentifier.cpp +++ b/src/Parsers/ASTIdentifier.cpp @@ -13,7 +13,6 @@ namespace DB namespace ErrorCodes { extern const int UNEXPECTED_AST_STRUCTURE; - extern const int SYNTAX_ERROR; } ASTIdentifier::ASTIdentifier(const String & short_name, ASTPtr && name_param) @@ -221,7 +220,7 @@ bool tryGetIdentifierNameInto(const IAST * ast, String & name) { if (ast) { - if (const auto * node = ast->as()) + if (const auto * node = dynamic_cast(ast)) { name = node->name(); return true;