Disallow creation of temporary tables with ON CLUSTER and with Repliacted table engines

This commit is contained in:
Roman Vasin 2023-01-30 08:08:20 +00:00
parent c09d8e744f
commit df4a9f111c

View File

@ -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<ASTFunction>();