2 ms·
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 refl
by koolba 6y ago
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.
- psYchotic 6y agoDeferred 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.html https://www.postgresql.org/docs/current/sql-set-constraints....