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.
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....