diff --git a/src/Databases/DatabaseFactory.cpp b/src/Databases/DatabaseFactory.cpp index 7f41010f8cf..264807534b3 100644 --- a/src/Databases/DatabaseFactory.cpp +++ b/src/Databases/DatabaseFactory.cpp @@ -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()->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( context, database_name, metadata_path, uuid, configuration.database, std::move(mysql_pool),