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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
     subscribe-nomail command to [EMAIL PROTECTED] so that your
     message can get through to the mailing list cleanly

Reply via email to