3 ms·
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. Howe
by psYchotic 5y ago
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.html https://www.postgresql.org/docs/current/sql-set-constraints....