From d65d00f496dac7c1700b44a2cba276299b1c298f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Wed, 5 Apr 2023 16:15:24 +0200 Subject: [PATCH 1/2] Don't check dependencies when renaming system tables automatically --- src/Interpreters/SystemLog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Interpreters/SystemLog.cpp b/src/Interpreters/SystemLog.cpp index 78513920236..c4bcc951500 100644 --- a/src/Interpreters/SystemLog.cpp +++ b/src/Interpreters/SystemLog.cpp @@ -503,6 +503,7 @@ void SystemLog::prepareTable() rename->elements.emplace_back(std::move(elem)); auto query_context = Context::createCopy(context); + query_context->setSetting("check_referential_table_dependencies", Field{false}); query_context->makeQueryContext(); InterpreterRenameQuery(rename, query_context).execute(); From 5d9e006c46bd92e398517d6e84232a2e5f835610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Wed, 5 Apr 2023 18:04:03 +0200 Subject: [PATCH 2/2] PR comments --- src/Interpreters/SystemLog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Interpreters/SystemLog.cpp b/src/Interpreters/SystemLog.cpp index c4bcc951500..fca7eccf93a 100644 --- a/src/Interpreters/SystemLog.cpp +++ b/src/Interpreters/SystemLog.cpp @@ -503,6 +503,8 @@ void SystemLog::prepareTable() rename->elements.emplace_back(std::move(elem)); auto query_context = Context::createCopy(context); + /// As this operation is performed automatically we don't want it to fail because of user dependencies on log tables + query_context->setSetting("check_table_dependencies", Field{false}); query_context->setSetting("check_referential_table_dependencies", Field{false}); query_context->makeQueryContext(); InterpreterRenameQuery(rename, query_context).execute();