Re: Nested Transaction TODO list - Mailing list pgsql-hackers

From Oliver Jowett
Subject Re: Nested Transaction TODO list
Date
Msg-id 40E8E3EE.9090207@opencloud.com
Whole thread Raw
In response to Re: Nested Transaction TODO list  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List 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
ROLLBACKTO 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Adding column comment to information_schema.columns
Next
From: Mario Weilguni
Date:
Subject: Re: LinuxTag wrapup