```
DROP TABLE IF EXISTS foo;

CREATE TABLE foo (timestamp DateTime, x UInt64)
ENGINE = MergeTree PARTITION BY toYYYYMMDD(timestamp)
ORDER BY (timestamp);

INSERT INTO foo (timestamp, x) SELECT toDateTime('2020-01-01 00:05:00'), number from system.numbers_mt LIMIT 100;

SELECT count() FROM system.mutations; -- ok

ALTER TABLE foo UPDATE x = 1 WHERE x = (SELECT x from foo WHERE x = 1);

SELECT count() FROM system.mutations; -- stuck

```
{
    NamesAndTypesList all_columns = metadata_snapshot->getColumns().getAllPhysical();
    
    for (size_t i = 0; i < prepared_stages.size(); ++i)
    {
        if (!prepared_stages[i].filters.empty())
        {
            for (const auto & column : all_columns)
                prepared_stages[i].output_columns.insert(column.name);
            continue;
        }
        if (i > 0)
            prepared_stages[i].output_columns = prepared_stages[i - 1].output_columns;
        if (prepared_stages[i].output_columns.size() < all_columns.size())
        {
            for (const auto & kv : prepared_stages[i].column_to_updated)
                prepared_stages[i].output_columns.insert(kv.first);
        }