From df4a9f111c56c183465c2c205be31fc0041f33f7 Mon Sep 17 00:00:00 2001 From: Roman Vasin Date: Mon, 30 Jan 2023 08:08:20 +0000 Subject: [PATCH] Disallow creation of temporary tables with ON CLUSTER and with Repliacted table engines --- src/Interpreters/InterpreterCreateQuery.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Interpreters/InterpreterCreateQuery.cpp b/src/Interpreters/InterpreterCreateQuery.cpp index cae18175757..01a6bb76f60 100644 --- a/src/Interpreters/InterpreterCreateQuery.cpp +++ b/src/Interpreters/InterpreterCreateQuery.cpp @@ -924,6 +924,13 @@ void InterpreterCreateQuery::setEngine(ASTCreateQuery & create) const if (create.storage && !create.storage->engine) throw Exception(ErrorCodes::INCORRECT_QUERY, "Invalid storage definition for temporary table: must be either ENGINE = Memory or empty"); */ + + if (!create.cluster.empty()) + throw Exception(ErrorCodes::INCORRECT_QUERY, "Temporary tables cannot be created with ON CLUSTER clause"); + + if (create.storage && create.storage->engine && create.storage->engine->name.starts_with("Replicated")) + throw Exception(ErrorCodes::INCORRECT_QUERY, "Temporary tables cannot be created with Replicated table engines"); + if (!create.storage) { auto engine_ast = std::make_shared();