Postgres doesn't like rescuing errors inside a transaction