```
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

```
size_t subquery_depth = select_options.subquery_depth;
    bool remove_duplicates = select_options.remove_duplicates;
    const auto & settings = getContext()->getSettingsRef();
    const NameSet & source_columns_set = result.source_columns_set;
    if (table_join)
    {
        result.analyzed_join = table_join;
        result.analyzed_join->resetCollected();
    }
    else 
        result.analyzed_join = std::make_shared<TableJoin>();
    if (remove_duplicates)
        renameDuplicatedColumns(select_query);
    if (tables_with_columns.size() > 1)
    {
        const auto & right_table = tables_with_columns[1];
        auto & cols_from_joined = result.analyzed_join->columns_from_joined_table;
        cols_from_joined = right_table.columns;
        
        
        cols_from_joined.insert(cols_from_joined.end(), right_table.hidden_columns.begin(), right_table.hidden_columns.end());
        result.analyzed_join->deduplicateAndQualifyColumnNames(
            source_columns_set, right_table.table.getQualifiedNamePrefix());
    }
    translateQualifiedNames(query, *select_query, source_columns_set, tables_with_columns);
    
    LogicalExpressionsOptimizer(select_query, settings.optimize_min_equality_disjunction_chain_length.value).perform();
    NameSet all_source_columns_set = source_columns_set;
    if (table_join)
    {