From 4bc32c638768c07eceb97ee6823a9400b8e40b9a Mon Sep 17 00:00:00 2001 From: kssenii Date: Mon, 16 Oct 2023 17:31:30 +0200 Subject: [PATCH] Fix uncaught exception in background tasj --- src/Databases/PostgreSQL/DatabasePostgreSQL.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp b/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp index e90dcfcd8ad..dea05ce19d8 100644 --- a/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp +++ b/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp @@ -322,8 +322,19 @@ void DatabasePostgreSQL::loadStoredObjects(ContextMutablePtr /* context */, Load void DatabasePostgreSQL::removeOutdatedTables() { std::lock_guard lock{mutex}; - auto connection_holder = pool->get(); - auto actual_tables = fetchPostgreSQLTablesList(connection_holder->get(), configuration.schema); + + std::set actual_tables; + try + { + auto connection_holder = pool->get(); + actual_tables = fetchPostgreSQLTablesList(connection_holder->get(), configuration.schema); + } + catch (...) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + cleaner_task->scheduleAfter(cleaner_reschedule_ms); + return; + } if (cache_tables) {