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

```
struct Settings;
struct SelectQueryOptions;
using Scalars = std::map<String, Block>;
struct StorageInMemoryMetadata;
using StorageMetadataPtr = std::shared_ptr<const StorageInMemoryMetadata>;
struct TreeRewriterResult
{
    ConstStoragePtr storage;
    StorageMetadataPtr metadata_snapshot;
    std::shared_ptr<TableJoin> analyzed_join;
    const ASTTablesInSelectQueryElement * ast_join = nullptr;
    NamesAndTypesList source_columns;
    NameSet source_columns_set; 
    
    NamesAndTypesList required_source_columns;
    
    Names required_source_columns_before_expanding_alias_columns;
    
    NameSet expanded_aliases;
    Aliases aliases;
    std::vector<const ASTFunction *> aggregates;
    std::vector<const ASTFunction *> window_function_asts;
    
    
    NameToNameMap array_join_result_to_source;
    
    
    
    NameToNameMap array_join_alias_to_name;