Re: Nested transactions

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Barry Lind <blind(at)xythos(dot)com>, simon(at)2ndquadrant(dot)com, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Nested transactions
Date: 2004-06-17 02:04:20
Message-ID: 200406170204.i5H24KR01850@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches

Alvaro Herrera wrote:
> On Thu, Jun 17, 2004 at 10:01:32AM +0800, Christopher Kings-Lynne 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? I assume we overwrite the original, but using nested
> > >transaction syntax seems much clearer.
> >
> > It also seems in this example that func_call() probably shouldn't have
> > permission to rollback to savepoint x? Otherwise it would get...weird.
>
> I don't think we should explicitly forbid it. I think it should be
> forbidden to close the outermost transaction inside a function (else the
> function would not be able to terminate correctly), but for levels
> before that one it'd be OK.

True. I see no reason to disallow it. Alvaro, you mentioned savepoint
levels, and I assume this to work around cases where they would need
the nested transactions that we are implementing.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-06-17 04:30:03 Re: Prepare Statement
Previous Message Bruce Momjian 2004-06-17 02:03:15 Re: Nested transactions

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2004-06-17 03:44:25 Some index entries
Previous Message Bruce Momjian 2004-06-17 02:03:15 Re: Nested transactions