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.
{
    const State & state = State::instance();
    check(state, 1,
          "SELECT column FROM test.table WHERE column LIKE '%hello%'",
          R"(SELECT "column" FROM "test"."table" WHERE "column" LIKE '%hello%')");
    check(state, 1,
          "SELECT column FROM test.table WHERE column NOT LIKE 'w%rld'",
          R"(SELECT "column" FROM "test"."table" WHERE "column" NOT LIKE 'w%rld')");
}
TEST(TransformQueryForExternalDatabase, Substring)
{
    const State & state = State::instance();
    check(state, 1,
          "SELECT column FROM test.table WHERE left(column, 10) = RIGHT(column, 10) AND SUBSTRING(column FROM 1 FOR 2) = 'Hello'",
          R"(SELECT "column" FROM "test"."table")");
}
TEST(TransformQueryForExternalDatabase, MultipleAndSubqueries)
{
    const State & state = State::instance();
    check(state, 1,
          "SELECT column FROM test.table WHERE 1 = 1 AND toString(column) = '42' AND column = 42 AND left(column, 10) = RIGHT(column, 10) AND column IN (1, 42) AND SUBSTRING(column FROM 1 FOR 2) = 'Hello' AND column != 4",
          R"(SELECT "column" FROM "test"."table" WHERE 1 AND ("column" = 42) AND ("column" IN (1, 42)) AND ("column" != 4))");
    check(state, 1,
          "SELECT column FROM test.table WHERE toString(column) = '42' AND left(column, 10) = RIGHT(column, 10) AND column = 42",
          R"(SELECT "column" FROM "test"."table" WHERE "column" = 42)");
}
TEST(TransformQueryForExternalDatabase, Issue7245)