5 ms·
Your first point is already there ;) it‘s called savepoints and works exactly like nested transactions.
by tpetry 5y ago
Your first point is already there ;) it‘s called savepoints and works exactly like nested transactions.
- aljungberg 5y agoUnfortunately savepoints only work for a non-transactional single connection test. E.g. you can only set a savepoint within a transaction. If the code under test, like an integration test, uses transactions itself, or multiple connections, savepoints won't help you. I would love to be able to globally revert all committed changes to a point in time. SUPER SAVEPOINT A; <NO HOLDS BARRED CODE USING MULTIPLE CONNECTIONS, TRANSACTIONS, NORMAL SAVEPOINTS ETC> SUPER RESTORE A; It could be implemented by playing the WAL logs backwards, I imagine. Alternatively, just making CREATE DATABASE WITH TEMPLATE fast would be nice. Even on tmpfs and no fsync this operation takes about 300 ms on my (fast) workstation. Then you could consider the template database a savepoint in itself.