postgresql transaction

Solutions on MaxInterview for postgresql transaction by the best coders in the world

showing results for - "postgresql transaction"
Léo
08 Feb 2017
1BEGIN;
2UPDATE accounts SET balance = balance - 100.00
3    WHERE name = 'Alice';
4SAVEPOINT my_savepoint;
5UPDATE accounts SET balance = balance + 100.00
6    WHERE name = 'Bob';
7-- oops ... forget that and use Wally's account
8ROLLBACK TO my_savepoint;
9UPDATE accounts SET balance = balance + 100.00
10    WHERE name = 'Wally';
11COMMIT;