pg-what-if-uses-transaction-rollback
IN premise
`what_if_retract`/`what_if_assert` perform real mutations inside a transaction, collect cascade effects, then rollback — reusing the propagation engine without duplicating logic.
Summary
The "what if" analysis features work by actually making changes to the database inside a transaction, observing what would happen as effects cascade through the system, and then rolling everything back so nothing is permanently altered. This is a clever design choice because it means the hypothetical reasoning uses the exact same propagation logic as real operations, avoiding the need to maintain a separate simulation engine that could drift out of sync.
Dependents
These beliefs depend on this one:
- pg-what-if-is-safely-simulated — PgApi's what-if operations achieve safe simulation: mutations are performed against real PostgreSQL data for accurate cascade analysis, then rolled back within a transaction to guarantee zero persistent side effects — combining fidelity with safety.
Details
| Source | entries/2026/04/29/reasons_lib-pg.md |