proposal: give savepoints automatic roll up ability. - Mailing list pgsql-hackers

From Merlin Moncure
Subject proposal: give savepoints automatic roll up ability.
Date
Msg-id 6EE64EF3AB31D5448D0007DD34EEB3417DD056@Herge.rcsinc.local
Whole thread Raw
List pgsql-hackers
Dear Hackers,
In the early days of savepoints (then nested transactions), it was
possible to push and pop sub-transactions in a kind of FIFO stack.
While the savepoint method certainly has its advantages, there are some
things I really miss about the old behavior, mostly because you had
finer grained control over failure behavior without resorting to client
side logic.

What about extending one of the current commands or adding a new command
that does the following:

If not in a transaction containing a savepoint, issue a warning or an
error.
If in a failed transaction containing a savepoint, rollback to the
specified (or last savepoint).
If in a valid transaction containing a savepoint, do a no-op.

esp=# begin;
BEGIN
esp=# savepoint x;
SAVEPOINT
esp=# foo;
ERROR:  syntax error at or near "foo" at character 1
LINE 1: foo;       ^
esp=# release x with rollback;
RELEASE
esp=# commit;
COMMIT; <-- not rollack
esp=#

ok. maybe this is another zany idea.  but I really think it would be
useful for things like scripts under certain circumstances.

Merlin


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Solving the OID-collision problem
Next
From: David Fetter
Date:
Subject: Re: small proposal: pg_config record flag variables?