Re: Nested Transactions, Abort All

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Thomas Swan <tswan(at)idigx(dot)com>
Cc: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Nested Transactions, Abort All
Date: 2004-07-09 15:47:51
Message-ID: 20040709154751.GC24668@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 09, 2004 at 10:38:15AM -0500, Thomas Swan wrote:

> visibility issue and how far do you unwind the depth of subtransactions
> or transactions?
>
> BEGIN
> UPDATE A
> SAVEPOINT X
> BEGIN
> BEGIN
> UPDATE B
> BEGIN
> UPDATE C
> ROLLBACK TO SAVEPOINT X

What happens here is that the user will go nuts. We will have a
prominent entry in the docs: "using both nested transactions and
savepoints inside a transaction can cause confusion. We recommend you
stick to one or the other." Or something like that.

(What would really happen: when ROLLBACK TO SAVEPOINT X is executed,
nested transactions created after the SAVEPOINT will be closed.)

So this is another reason why we should use COMMIT to close a nested
transaction: it may refer to a transaction that is already closed
because the user got confused.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"I can't go to a restaurant and order food because I keep looking at the
fonts on the menu. Five minutes later I realize that it's also talking
about food" (Donald Knuth)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2004-07-09 16:03:38 Re: Nested Transactions, Abort All
Previous Message Stephen Frost 2004-07-09 15:47:26 Re: User Quota Implementation