1.7 Error on empty result from table definition queries

Same as #1686 but for the 1.7 branch