```
drop table IF EXISTS numbers_indexed;
drop table IF EXISTS squares;

create table numbers_indexed Engine=MergeTree ORDER BY number PARTITION BY bitShiftRight(number,8) SETTINGS index_granularity=8 AS SELECT * FROM numbers(16384); 

CREATE VIEW squares AS WITH number*2 AS square_number SELECT number, square_number FROM numbers_indexed;

SET max_rows_to_read=8, read_overflow_mode='throw';

-- ok
WITH number*2 AS square_number SELECT number, square_number FROM numbers_indexed WHERE number = 999;

-- fail
SELECT * FROM squares WHERE number = 999;
```
{
    std::vector<ASTPtr> res;
    for (const auto & predicate : predicates)
    {
        if (!predicate)
            continue;
        res.emplace_back(predicate);
        for (size_t idx = 0; idx < res.size();)
        {
            ASTPtr expression = res.at(idx);
            if (const auto * function = expression->as<ASTFunction>(); function && function->name == "and")
            {
                res.erase(res.begin() + idx);
                for (auto & child : function->arguments->children)
                    res.emplace_back(child);
                continue;
            }
            ++idx;
        }
    }
    return res;
}
std::vector<ASTs> PredicateExpressionsOptimizer::extractTablesPredicates(const ASTPtr & where, const ASTPtr & prewhere)