Re: BUG #13940: rollback prepared is not working

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: prathameshsonavane(at)gmail(dot)com
Cc: Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13940: rollback prepared is not working
Date: 2016-02-10 16:52:26
Message-ID: CAMkU=1zcbZZRjwhjQuQ=Y6zHUomKtUKMXNnSzwuiogyO4pxCtg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Feb 10, 2016 at 2:46 AM, <prathameshsonavane(at)gmail(dot)com> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 13940
> Logged by: Prathamesh Sonavane
> Email address: prathameshsonavane(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2016-02-10 17:01:00 Re: BUG #13941: Different value "pg_constraint.consrc" for similar Check Constrait
Previous Message Alvaro Herrera 2016-02-10 16:52:22 Re: BUG #13935: Duplicate row in pg_constraint table which is not accessible via indexes