Apakah mungkin menjalankan/membuat banyak transaksi dalam satu sesi di postgresql?

BEGIN transaction; --tran1
update  table set b=1; 


BEGIN transaction;  --tran2
update  table set b=2;

COMMIT transaction;
COMMIT transaction;
0
Arcil Tralleis 27 Mei 2021, 22:39

1 menjawab

Jawaban Terbaik

Ya, itu disebut SAVEPOINT:

BEGIN;
    update  table set b=1; 
    SAVEPOINT my_savepoint;
    update  table set b=2;
    RELEASE SAVEPOINT my_savepoint;
COMMIT;
1
Frank Heikens 27 Mei 2021, 19:43