One remaining problem is writing dynamic queries without giving up static verification completely.
For example, optional WHERE, ORDER BY, GROUP BY clauses are very common. Currently the solutions are:
* Give up and write a fully dynamic query. * Generate every possible permutation. Combinatorial explosion quickly makes this impractical. * Write a static query without the optional clauses, then add clauses and execute a dynamic query. The best of both worlds but complicated.
However the optional clauses are almost always independent from each other. It should be possible to statically verify each one with `SELECT NULL FROM <full set of JOINs> WHERE/ORDER BY/GROUP BY <optional clause>`.