diff --git a/src/Interpreters/DatabaseCatalog.cpp b/src/Interpreters/DatabaseCatalog.cpp index 35c12270da15..6807835a2066 100644 --- a/src/Interpreters/DatabaseCatalog.cpp +++ b/src/Interpreters/DatabaseCatalog.cpp @@ -1572,6 +1572,9 @@ void DatabaseCatalog::checkTableCanBeAddedWithNoCyclicDependencies( const TableNamesSet & new_referential_dependencies, const TableNamesSet & new_loading_dependencies) { + if (new_referential_dependencies.empty() && new_loading_dependencies.empty()) + return; + std::lock_guard lock{databases_mutex}; StorageID table_id = StorageID{table_name};