Fix intermittent test failures on Postgres due to ordering