```
CREATE TABLE a
(
    `number` UInt64,
    `x` MATERIALIZED x
)
ENGINE = MergeTree
ORDER BY number;
-- that should fail!

insert into a values (1);
Received exception from server (version 21.7.1):
Code: 47. DB::Exception: Received from localhost:9000. DB::Exception: Missing columns: 'x' while processing query: 'CAST(x, 'UInt8') AS x', required columns: 'x' 'x'. 
```
}
    else
        return;
    ASTs new_elements;
    new_elements.reserve(elements.size());
    for (const auto & elem : elements)
    {
        String name = elem->getAliasOrColumnName();
        auto it = required_columns_with_duplicate_count.find(name);
        if (required_columns_with_duplicate_count.end() != it && it->second)
        {
            new_elements.push_back(elem);
            --it->second;
        }
        else if (select_query->distinct || hasArrayJoin(elem))
        {
            new_elements.push_back(elem);
        }
        else
        {
            ASTFunction * func = elem->as<ASTFunction>();
            
            
            if (func && func->name == "untuple")
                new_elements.push_back(elem);
        }
    }
    elements = std::move(new_elements);
}
void executeScalarSubqueries(ASTPtr & query, ContextConstPtr context, size_t subquery_depth, Scalars & scalars, bool only_analyze)