Thread: Re: [PATCHES] nested xacts and phantom Xids

Re: [PATCHES] nested xacts and phantom Xids

From
Alvaro Herrera
Date:
On Sat, Jun 26, 2004 at 12:42:28AM -0400, Alvaro Herrera wrote:

> - discussion whether we want a different syntax for subxacts, like
>   SUBBEGIN/SUBCOMMIT/SUBABORT instead of BEGIN/COMMIT/ABORT.  Please
>   comment on this point.

It has been suggested a couple of times that we should use a different
syntax for subtransactions than for main transactions.  This would for
example allow things like


BEGIN;do something;SUBBEGIN;    do something else;    SUBBEGIN;        do more things;        ...
COMMIT;

And issue a single COMMIT (or ROLLBACK) to get rid of the whole thing.
(This is suspiciously similar to SAVEPOINTs).  Another nice idea would
be to be able to name subtransactions and rollback to a name, which
would bring savepoints even nearer.  Also maybe a subcommit <name> would
commit everything within that name (not sure if this is a good idea).

Please comment.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Este mail se entrega garantizadamente 100% libre de sarcasmo.



Re: [PATCHES] nested xacts and phantom Xids

From
Dennis Bjorklund
Date:
On Sat, 26 Jun 2004, Alvaro Herrera wrote:

> (This is suspiciously similar to SAVEPOINTs).  Another nice idea would
> be to be able to name subtransactions and rollback to a name, which
> would bring savepoints even nearer.

Sounds exactly like savepoints. What is the difference and why don't we do
savepoints instead?

-- 
/Dennis Björklund



Re: [PATCHES] nested xacts and phantom Xids

From
Greg Stark
Date:
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:

> It has been suggested a couple of times that we should use a different
> syntax for subtransactions than for main transactions.  This would for
> example allow things like
> 
> 
> BEGIN;
>     do something;
>     SUBBEGIN;

It might be awkward for clients like psql that will want to execute every
command in a nested transaction. It would mean they would have to know whether
the user has started a transaction or not in order to know whether to use
"BEGIN" or "SUBBEGIN". But I guess they would have to do that anyways unless
there's some protocol level way to indicate a query should be executed in a
nested transaction.

-- 
greg