Re: Nested Transaction TODO list

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Nested Transaction TODO list
Date: 2004-07-05 05:15:26
Message-ID: 40E8E3EE.9090207@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:

>>One generalization of this to nested transactions would be:
>>
>> SUBBEGIN [transactionname]
>> SUBCOMMIT [transactionname]
>> SUBABORT [transactionname]
>
>
> The only departure from the SAVEPOINT syntax is that you are able to
> "subcommit" a savepoint. Not sure how useful that is ...

One thing SUBCOMMIT [name] does allow is discarding savepoints / named
txns without rolling back their changes. That might be useful if we
allow nesting of names, e.g.:

SAVEPOINT save1
-- do work #1
SAVEPOINT save1 -- hides the earlier SAVEPOINT
-- do work #2
SAVEPOINT save2
-- do work #3
SUBCOMMIT save1 -- provisionally commits #2 and #3 to enclosing txn
-- do work #4
ROLLBACK TO save1 -- rolls back #1, #2, #3, #4

Other than that.. I assume we want SUBBEGIN/SUBCOMMIT/SUBABORT
regardless of how we do savepoints. Since savepoints are a subset of
what you can do with nested transactions, it seems appropriate that
SUBBEGIN etc. can do everything that savepoints can -- i.e. naming of
savepoints/transactions. And then SUBCOMMIT [name] is just there for
completeness.

-O

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mario Weilguni 2004-07-05 06:09:39 Re: LinuxTag wrapup
Previous Message Tom Lane 2004-07-05 04:41:08 Re: Adding column comment to information_schema.columns