Re: BUG #13940: rollback prepared is not working - Mailing list pgsql-bugs

From Jeff Janes
Subject Re: BUG #13940: rollback prepared is not working
Date
Msg-id CAMkU=1zcbZZRjwhjQuQ=Y6zHUomKtUKMXNnSzwuiogyO4pxCtg@mail.gmail.com
Whole thread Raw
In response to BUG #13940: rollback prepared is not working  (prathameshsonavane@gmail.com)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #13941: Different value "pg_constraint.consrc" for similar Check Constrait
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #13935: Duplicate row in pg_constraint table which is not accessible via indexes