Re: Nested transactions - Mailing list pgsql-patches

From Alvaro Herrera
Subject Re: Nested transactions
Date
Msg-id 20040617015842.GB5925@dcc.uchile.cl
Whole thread Raw
In response to Re: Nested transactions  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
On Wed, Jun 16, 2004 at 09:36:33PM -0400, Bruce Momjian wrote:

> And consider this case:
>
>     BEGIN;
>     ...
>     SAVEPOINT x;
>     SELECT func_call();
>     SELECT func_call();
>     COMMIT;
>
> Now if func_call has a savepoint, it is really nested because it can't
> know whether the savepoint X will be used to roll back, so its status is
> dependent on the status of X.  Now, if we used savepoints in func_call,
> what happens in the second function call when we define a savepoint with
> the same name?

Hm, that's a good question.  What happens if you define two savepoints
with the same name?  According to SQL2003, the previous savepoint "is
destroyed", but it's not clear to me whether this means rolling back all
of its changes or just forgetting it.  What's clear is that you can roll
back only to the latest one.

Also, in SQL2003 there can be multiple "savepoint levels".  I think for
a first implementation it would be fine if we had only one level.  It
would, wouldn't it?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Estoy de acuerdo contigo en que la verdad absoluta no existe...
El problema es que la mentira sí existe y tu estás mintiendo" (G. Lama)


pgsql-patches by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: Nested transactions
Next
From: Alvaro Herrera
Date:
Subject: Re: Nested transactions