Is it possible to run/create multiple transactions in one session in postgresql?
BEGIN transaction; --tran1
update table set b=1;
BEGIN transaction; --tran2
update table set b=2;
COMMIT transaction;
COMMIT transaction;
Yes, that's called a SAVEPOINT:
BEGIN;
update table set b=1;
SAVEPOINT my_savepoint;
update table set b=2;
RELEASE SAVEPOINT my_savepoint;
COMMIT;