diff --git a/src/Interpreters/JoinToSubqueryTransformVisitor.cpp b/src/Interpreters/JoinToSubqueryTransformVisitor.cpp index 3d5c096e8cf..5879c96f7b3 100644 --- a/src/Interpreters/JoinToSubqueryTransformVisitor.cpp +++ b/src/Interpreters/JoinToSubqueryTransformVisitor.cpp @@ -546,9 +546,9 @@ std::vector normalizeColumnNamesExtractNeeded( { auto alias = aliases.find(ident->name())->second; auto alias_ident = alias->clone(); - if ( alias_ident->as()) + if (auto * alias_ident_typed = alias_ident->as()) { - alias_ident->as()->restoreTable(); + alias_ident_typed->restoreTable(); bool alias_equals_column_name = alias_ident->getColumnNameWithoutAlias() == ident->getColumnNameWithoutAlias(); if (!alias_equals_column_name) throw Exception("Alias clashes with qualified column '" + ident->name() + "'", ErrorCodes::AMBIGUOUS_COLUMN_NAME);