Typed static queries

I'm opening this PR so we can discuss the current state of the implementation.
I'm not sure that it should be a warning, either. This could be a transient failure which would lead to strange results when we just generate a warning and create a different tree. Better fail in case of an exception. If it's not transient, users should be encouraged to use sql or sqlu instead of tsql.