Allow using overviews with simple queries

Simple queries are queries like: "( SELECT * FROM mytable ) as foo".
Actually with this commit there are more cases supported, all the
ones containing a "FROM <tablename>" substring, which may or may
not break the code.

Also, the "use_overviews" parameter is not fatal anymore if the
code cannot derive a table name from the subquery.