Fix normalization of UNION inside DESCRIBE query

This commit is contained in:
Maksim Kita 2022-10-11 15:50:42 +02:00
parent 77ea9a11cd
commit 3a22e37691
3 changed files with 5 additions and 4 deletions

View File

@ -2286,9 +2286,9 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromJoin(const IdentifierLoo
else
{
throw Exception(ErrorCodes::AMBIGUOUS_IDENTIFIER,
"JOIN {} ambiguous identifier {}. In scope {}",
"JOIN {} ambiguous identifier '{}'. In scope {}",
table_expression_node->formatASTForErrorMessage(),
identifier_lookup.dump(),
identifier_lookup.identifier.getFullName(),
scope.scope_node->formatASTForErrorMessage());
}
}

View File

@ -45,7 +45,7 @@ void NormalizeSelectWithUnionQueryMatcher::visit(ASTSelectWithUnionQuery & ast,
SelectUnionModesSet current_set_of_modes;
bool distinct_found = false;
for (ssize_t i = union_modes.size() - 1; i >= 0; --i)
for (Int64 i = union_modes.size() - 1; i >= 0; --i)
{
current_set_of_modes.insert(union_modes[i]);
if (const auto * union_ast = typeid_cast<const ASTSelectWithUnionQuery *>(select_list[i + 1].get()))

View File

@ -33,7 +33,8 @@ bool ParserDescribeTableQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & ex
if (!ParserTableExpression().parse(pos, table_expression, expected))
return false;
query->table_expression = table_expression;
query->children.push_back(std::move(table_expression));
query->table_expression = query->children.back();
node = query;