Query compilation should happen within a db transaction

In order to successfully compile equality predicates, we need to know
exactly which database the user is talking to (PG8, PG9, HSQLDB). That
lets us figure out if we can use a fast-path (for array queries).
Merge pull request #620 from grimradical/fix-broken-acceptance-tests

Query compilation should happen within a db transaction
(#21468) Separate commands and queries between different Puppetdb instances

Signed-off-by: Ken Barber <ken@bob.sh>