Do not query CDB_TableMetadata for queries affected by no tables

Closes #16