Re: A transaction in transaction? Possible?

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
Subject: Re: A transaction in transaction? Possible?
Date: 2004-11-11 08:10:56
Message-ID: 41931E90.2050108@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Achilleus Mantzios wrote:
> O Michael Fuhr έγραψε στις Nov 10, 2004 :
>
>
>>On Wed, Nov 10, 2004 at 12:45:19AM -0800, Riccardo G. Facchini wrote:
>>
>>
>>>Sorry, but I understand that your example is not really about nested
>>>transactions, but about sequential transactions.
>>
>>Here's a more elaborate example. If this doesn't demonstrate the
>>capability you're looking for, then please provide an example of
>>what you'd like to do and describe the desired behavior.
>>
>>CREATE TABLE person (id SERIAL PRIMARY KEY, name TEXT NOT NULL);
>>
>>BEGIN;
>> INSERT INTO person (name) VALUES ('Alice');
>>
>> SAVEPOINT s1;
>> INSERT INTO person (name) VALUES ('Bob');
>>
>> SAVEPOINT s2;
>> INSERT INTO person (name) VALUES ('Charles');
>>
>> SAVEPOINT s3;
>> INSERT INTO person (name) VALUES ('David');
>> ROLLBACK TO s3;
>>
>> INSERT INTO person (name) VALUES ('Edward');
>> ROLLBACK TO s2;
>>
>> INSERT INTO person (name) VALUES ('Frank');
>> RELEASE s1;
>>
>> INSERT INTO person (name) VALUES ('George');
>>COMMIT;
>
>
> Just a very naive thought....
> Wouldn't make more sense to allow nested begin/commit/rollback blocks?

Is not naive because in this way you can do what you could do with
nested begin/commit/rollback blocks, in this way you can do more.
Think for example in the example above to convert the "ROLLBACK TO s3"
in a "ROLLBACK TO s1", that is impossible to do with begin/commit/rollback blocks.

Regards
Gaetano Mendola

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gaetano Mendola 2004-11-11 08:23:24 Re: A transaction in transaction? Possible?
Previous Message Stefan Weiss 2004-11-10 21:36:41 Re: A transaction in transaction? Possible?