Re: A transaction in transaction? Possible?

From: "Andrei Bintintan" <klodoma(at)ar-sd(dot)net>
To: "Achilleus Mantzios" <achill(at)matrix(dot)gatewaynet(dot)com>, "Michael Fuhr" <mike(at)fuhr(dot)org>
Cc: "Riccardo G(dot) Facchini" <abief_ag_-postgresql(at)yahoo(dot)com>, <pgsql-sql(at)postgresql(dot)org>, "Theodore Petrosky" <tedpet5(at)yahoo(dot)com>, "sad" <sad(at)bankir(dot)ru>
Subject: Re: A transaction in transaction? Possible?
Date: 2004-11-10 10:37:54
Message-ID: 019801c4c711$57185380$0b00a8c0@forge
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Okay, I see you're speaking about pgsql 8.0

What about 7.4?

Andy.

----- Original Message -----
From: "Achilleus Mantzios" <achill(at)matrix(dot)gatewaynet(dot)com>
To: "Michael Fuhr" <mike(at)fuhr(dot)org>
Cc: "Riccardo G. Facchini" <abief_ag_-postgresql(at)yahoo(dot)com>;
<pgsql-sql(at)postgresql(dot)org>; "Theodore Petrosky" <tedpet5(at)yahoo(dot)com>; "Andrei
Bintintan" <klodoma(at)ar-sd(dot)net>; "sad" <sad(at)bankir(dot)ru>
Sent: Wednesday, November 10, 2004 12:58 PM
Subject: Re: [SQL] A transaction in transaction? Possible?

> 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?
>
> >
> > SELECT * FROM person;
> > id | name
> > ----+--------
> > 1 | Alice
> > 2 | Bob
> > 6 | Frank
> > 7 | George
> >
> > If you change "ROLLBACK TO s2" to "RELEASE s2" then you get this:
> >
> > id | name
> > ----+---------
> > 1 | Alice
> > 2 | Bob
> > 3 | Charles
> > 5 | Edward
> > 6 | Frank
> > 7 | George
> >
> > If you change "RELEASE s1" to "ROLLBACK TO s1" then you get this:
> >
> > id | name
> > ----+--------
> > 1 | Alice
> > 7 | George
> >
> >
>
> --
> -Achilleus
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2004-11-10 10:58:27 Re: A transaction in transaction? Possible?
Previous Message Michael Fuhr 2004-11-10 09:53:52 Re: A transaction in transaction? Possible?