More fixes

This commit is contained in:
Ivan Lezhankin 2020-11-13 17:34:47 +03:00
parent d69b6307b5
commit fb473e6f9c
4 changed files with 5 additions and 7 deletions

View File

@ -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<ASTTableExpression>())
{
@ -69,7 +69,7 @@ public:
is_table = true;
}
}
else if (ast->as<ASTIdentifier>())
else if (ast->as<ASTTableIdentifier>())
is_table = true;
if (!subquery_or_table_name)

View File

@ -8,7 +8,6 @@ namespace DB
namespace ErrorCodes
{
extern const int SYNTAX_ERROR;
extern const int AMBIGUOUS_COLUMN_NAME;
}

View File

@ -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<ASTIdentifier>())
{
ptr = func.clone();
ptr->as<ASTFunction>()->arguments->children[1] = ast->as<ASTIdentifier>()->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<ASTIdentifier>())
{
ptr = func.clone();
ptr->as<ASTFunction>()->arguments->children[0] = ast->as<ASTIdentifier>()->createTable();

View File

@ -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<ASTIdentifier>())
if (const auto * node = dynamic_cast<const ASTIdentifier *>(ast))
{
name = node->name();
return true;