random test order fixes for PostgreSQL

I fixed some failing test cases (not ALL) while running the tests in random order.