N. Ramirez escribió: > I do not have an operation as it must be when use the functions to do > 2-phase commit > > Example create table prueba (a int, b int); > begin; > PREPARE TRANSACTION 'aaaa'; > insert into prueba values (1,2); > ROLLBACK PREPARED 'aaaa'; select * from prueba > a b > ----------------------------- > 1 2 > because? > it did not do rollback? > as it is used the method of 2-phase commit?
It did rollback, but you put the insert outside the prepared transaction, so it was committed independently. Try this: alvherre=# create table prueba (a int, b int); CREATE TABLE alvherre=# begin; BEGIN alvherre=# insert into prueba values (1, 2); INSERT 0 1 alvherre=# prepare transaction 'aaaa'; PREPARE TRANSACTION alvherre=# select * from prueba; a | b ---+--- (0 filas) alvherre=# rollback prepared 'aaaa'; ROLLBACK PREPARED alvherre=# select * from prueba; a | b ---+--- (0 filas) alvherre=# begin; BEGIN alvherre=# insert into prueba values (1, 2); INSERT 0 1 alvherre=# prepare transaction 'bbb'; PREPARE TRANSACTION alvherre=# select * from prueba; a | b ---+--- (0 filas) alvherre=# commit prepared 'bbb'; COMMIT PREPARED alvherre=# select * from prueba; a | b ---+--- 1 | 2 (1 fila) > idem for use of dblink Not sure what you mean here. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly