Print CREATE, not ATTACH

This commit is contained in:
Stig Bakken 2021-11-16 14:59:11 +01:00
parent eb5115adb8
commit 9190a883d3

View File

@ -214,13 +214,17 @@ DatabasePtr DatabaseFactory::getImpl(const ASTCreateQuery & create, const String
materialize_mode_settings->loadFromQuery(*engine_define);
if (uuid == UUIDHelpers::Nil)
{
auto print_create_ast = create.clone();
print_create_ast->as<ASTCreateQuery>()->attach = false;
throw Exception(
fmt::format(
"The MaterializedMySQL database engine no longer supports Ordinary databases. To re-create the database, delete "
"the old one by executing \"rm -rf {}{{,.sql}}\", then re-create the database with the following query: {}",
metadata_path,
queryToString(create)),
queryToString(print_create_ast)),
ErrorCodes::NOT_IMPLEMENTED);
}
return std::make_shared<DatabaseMaterializedMySQL>(
context, database_name, metadata_path, uuid, configuration.database, std::move(mysql_pool),