From c1c390348ebee7a8c0d30a4b558784931125a3ad Mon Sep 17 00:00:00 2001 From: serxa Date: Thu, 2 Nov 2023 17:07:21 +0000 Subject: [PATCH] `DatabaseCatalog::getTable()` should also wait --- src/Interpreters/DatabaseCatalog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Interpreters/DatabaseCatalog.cpp b/src/Interpreters/DatabaseCatalog.cpp index 2e82ff464d2..e1d8d0d4bf6 100644 --- a/src/Interpreters/DatabaseCatalog.cpp +++ b/src/Interpreters/DatabaseCatalog.cpp @@ -349,6 +349,9 @@ DatabaseAndTable DatabaseCatalog::getTableImpl( return {}; } + /// Wait for table to be started because we are going to return StoragePtr + db_and_table.first->waitTableStarted(table_id.getTableName()); + #if USE_LIBPQXX if (!context_->isInternalQuery() && (db_and_table.first->getEngineName() == "MaterializedPostgreSQL")) {