When using a foreign table (e.g. a mysql table) clickhouse doesn't seem to properly send the result of functions if they are called inside `WHERE` statements.

Executing `SELECT foo FROM foreign_table WHERE a=10 AND b='2019-10-05'` will send a statement like:

```
SELECT `foo`, `a`, `b` FROM `db`.`foreign_table`  WHERE (`a` = 10) AND (`b` = '2019-10-05')
```

But executing `SELECT foo FROM foreign_table WHERE a=10 AND b=toDate('2019-10-05')` will send:

```
SELECT `foo`, `a`, `b` FROM `db`.`foreign_table`  WHERE (`a` = 10)
```

I assume that the function is executed afterwards and `b` is parsed clickhouse-side.

I'm not sure if there is an easy fix for this, but I assume this would help with the efficiency of mysql foreign tables and might be critical in some high-load scenarios where one wants to filter on indexed columns.

My specific issue here is different and relates to the clickhouse mindsdb integration, but I think this "bug" (if you'd call it such) is more generic.
: context(Context::createCopy(getContext().context))
    {
        tryRegisterFunctions();
        DatabasePtr database = std::make_shared<DatabaseMemory>("test", context);
        for (const auto & tab : tables)
        {
            const auto & table_name = tab.table.table;
            const auto & db_name = tab.table.database;
            database->attachTable(
                context,
                table_name,
                std::make_shared<StorageMemory>(
                    StorageID(db_name, table_name), ColumnsDescription{getColumns()}, ConstraintsDescription{}, String{}));
        }
        DatabaseCatalog::instance().attachDatabase(database->getDatabaseName(), database);
        context->setCurrentDatabase("test");
    }
};
static void check(