two-phase-commit

Using two phase commits on postgres

我们两清 提交于 2019-12-11 15:51:19
问题 Asumming that a have a table called "t1" in a "db1" and other table called "t2" in a "db2", and i need to insert a record on both tables or fails. Connected to the db1 i guess i shall type this BEGIN; PREPARE TRANSACTION 'pepe'; -- this says the manual that makes your transaction gets stored on disk, so what is the purpose if i can't use it from another database?) insert into t1 (field) values ('a_value'); COMMIT PREPARED 'pepe' Connected to the db2 i guess that BEGIN; PREPARE TRANSACTION