diff --git a/dbms/src/Interpreters/TranslateQualifiedNamesVisitor.cpp b/dbms/src/Interpreters/TranslateQualifiedNamesVisitor.cpp index febc9753366..35aa9461709 100644 --- a/dbms/src/Interpreters/TranslateQualifiedNamesVisitor.cpp +++ b/dbms/src/Interpreters/TranslateQualifiedNamesVisitor.cpp @@ -75,7 +75,8 @@ std::vector TranslateQualifiedNamesMatcher::visit(ASTIdentifier & iden /// In case if column from the joined table are in source columns, change it's name to qualified. if (best_table_pos && data.source_columns.count(identifier.shortName())) IdentifierSemantic::setNeedLongName(identifier, true); - IdentifierSemantic::setColumnNormalName(identifier, data.tables[best_table_pos].first); + if (!data.tables.empty()) + IdentifierSemantic::setColumnNormalName(identifier, data.tables[best_table_pos].first); } return {};