Re: BUG #2507: Problem using two-phase commit

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: BUG #2507: Problem using two-phase commit
Дата
Msg-id 20060701145422.GB7566@surnet.cl
обсуждение исходный текст
Ответ на BUG #2507: Problem using two-phase commit  ("N. Ramirez" <noramirez@speedy.com.ar>)
Список pgsql-bugs
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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Paul Röttgerding"
Дата:
Сообщение: BUG #2498: Problem with ADO.RECORDSET.UPDATE
Следующее
От: "ONG JIIN ME"
Дата:
Сообщение: BUG #2509: ODBC TIMESTAMP UPDATE FAILED