News for hackers. Stuff that matters.
Re:Pg_tmp – Run tests on an isolated, temporary PostgreSQL d... by koolba on Monday April 26, 2021 @07:24PM (#26949609)
Unless your transactional code relies on deferred constraints. They don’t get checked until commit time so any test that rolls back upon “success” will not reflect an error.
Re:Pg_tmp – Run tests on an isolated, temporary PostgreSQL d... by psYchotic on Tuesday April 27, 2021 @04:49AM (#26953564)
Deferred constraints can be awesome, but as you point out, they can be a massive blind spot in tests that rely on transactions to keep the database clean.

However, I've had success with using the `SET CONSTRAINTS ALL IMMEDIATE`[0] statement prior to rolling back the transaction.

[0]: https://www.postgresql.org/docs/current/sql-set-constraints....