ExternalDictionariesLoader fix getCurrentDatabase multiple times

This commit is contained in:
Maksim Kita 2021-12-06 14:01:56 +03:00
parent 4c916a0e38
commit 1ec9039b1d

View File

@ -98,12 +98,12 @@ QualifiedTableName ExternalDictionariesLoader::qualifyDictionaryNameWithDatabase
/// If dictionary was not qualified with database name, try to resolve dictionary as xml dictionary.
if (qualified_name->database.empty() && !has(qualified_name->table))
{
auto current_database_name = query_context->getCurrentDatabase();
std::string current_database_name = query_context->getCurrentDatabase();
std::string resolved_name = resolveDictionaryNameFromDatabaseCatalog(dictionary_name, current_database_name);
/// If after qualify dictionary_name with default_database_name we find it, add default_database to qualified name.
if (has(resolved_name))
qualified_name->database = query_context->getCurrentDatabase();
qualified_name->database = std::move(current_database_name);
}
return *qualified_name;