Fork me on GitHub
#sql
<
2020-05-28
>
souenzzo19:05:24

Hello I'm trying to write some test-fixtures to run my app and rollback after the test but I'm getting: ERROR: ROLLBACK TO SAVEPOINT can only be used in transaction blocks If it's really not possible, I would ask at least some more info about transaction blocks (and how they compose) https://gist.github.com/souenzzo/2783a30bc8d5b904a7b1e0ecf8cbe082

seancorfield19:05:24

Transactions cannot be nested.

seancorfield19:05:39

You're also trying to stand up two overlapping transactions on a single connection which cannot work.

seancorfield19:05:06

Connections are auto-commit by default so single SQL operations do not need to be wrapped in a transaction -- you only need a (single) transaction wrapped around a group of SQL operations that you need to be atomically committed (or rolled back).