Обсуждение: BUG #13940: rollback prepared is not working

Поиск
Список
Период
Сортировка

BUG #13940: rollback prepared is not working

От
prathameshsonavane@gmail.com
Дата:
The following bug has been logged on the website:

Bug reference:      13940
Logged by:          Prathamesh Sonavane
Email address:      prathameshsonavane@gmail.com
PostgreSQL version: 9.2.14
Operating system:   windows 7 enterprise
Description:

I am trying following prepared transaction:

(
BEGIN TRANSACTION;
PREPARE TRANSACTION 'B';
UPDATE xyz
SET   jkl=20 WHERE lmn="XX";
)

Now it will change value of jkl to 20.
Now i am executing following query b4 "commit prepared B":

(
rollback PREPARED 'B';
)


indeed..it shud set jkl to its old value.but, still its showing 20 after
issuing this command. its very annoying. :(

Re: BUG #13940: rollback prepared is not working

От
Jeff Janes
Дата:
On Wed, Feb 10, 2016 at 2:46 AM,  <prathameshsonavane@gmail.com> wrote:
> The following bug has been logged on the website:
>
> Bug reference:      13940
> Logged by:          Prathamesh Sonavane
> Email address:      prathameshsonavane@gmail.com
> PostgreSQL version: 9.2.14
> Operating system:   windows 7 enterprise
> Description:
>
> I am trying following prepared transaction:
>
> (
> BEGIN TRANSACTION;
> PREPARE TRANSACTION 'B';

You have just started a transaction, and then immediately frozen the
transaction.  That transaction is now over, other than to commit it or
roll it back.  Anything done after this point will be part of a
different transaction.

You have to put the "prepare transaction" at the end of the
transaction, where the commit would otherwise go.  Not immediately
after the BEGIN.


> UPDATE xyz
> SET   jkl=20 WHERE lmn="XX";

Now you have a new single-statement transaction which was
automatically committed.

> )
>
> Now it will change value of jkl to 20.
> Now i am executing following query b4 "commit prepared B":
>
> (
> rollback PREPARED 'B';
> )
>

Now you have rolled back a prepared transaction, but that transaction
was empty, so rolling it back didn't do anything.

So, this is not a bug, it is operating as designed.

Cheers,

Jeff