Refactor query.rb and backfill tests for error cases
Fix IN clause behavior for foreign keys
[finishes #78842212]
Grouping query tests to make them easier to read