It hurts if server has millions of tables.

See https://github.com/ClickHouse/ClickHouse/pull/3398
Please add some tests to ensure it won't be broken in future.
const String & table_metadata_tmp_path, const String & table_metadata_path)
{
    try
    {
        
        attachTable(query.table, table, getTableDataPath(query));
        
        
        Poco::File(table_metadata_tmp_path).renameTo(table_metadata_path);
    }
    catch (...)
    {
        Poco::File(table_metadata_tmp_path).remove();
        throw;
    }
}
void DatabaseOnDisk::dropTable(const Context & context, const String & table_name, bool )