Honor schema in SQL query (Issue #931)

Or: Eating the same half of the pie twice

The issue was that even though the table expression has the correct schema the SQL generation was not using it.