Nested transactions, 1st try

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: pgsql-patches(at)postgresql(dot)org
Subject: Nested transactions, 1st try
Date: 2003-04-17 22:57:54
Message-ID: 20030417225754.GA5370@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hackers,

Sorry for taking so long. Hopefully next iterations will be quicker.

This is the first attempt at supporting nested transactions. Mainly,
some global per-transaction structures have been converted into stacks
or something equivalent. These are:
- deferred triggers
- snapshot data
- smgr pending deletes

Also, LWLocks are marked with a transaction ID that should allow
releasing a child transaction lock's all together, without releasing its
parent's.

Lastly, there's transaction block state support.

There are a lot of things missing, tuple visibility rules being the most
obvious. This passes the regression tests, but in no way the semantics
of subtransactions are correct. I post this so people can look at the
approaches taken and say whether they are right or wrong.

For example, this works:

BEGIN;
BEGIN;
CREATE TABLE foo (one int);
ROLLBACK;
CREATE TABLE bar (two int);
COMMIT;
(only table bar is created)

But this doesn't:

BEGIN;
CREATE TABLE bar (two int);
BEGIN;
CREATE TABLE foo (one int);
ROLLBACK;
COMMIT;
(no table is created).

I will continue working on this. Comments are very much welcome.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The first of April is the day we remember what we are
the other 364 days of the year" (Mark Twain)

Attachment Content-Type Size
nested-transactions-1.patch text/plain 85.2 KB

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2003-04-18 00:21:22 Re: [HACKERS] Are we losing momentum?
Previous Message Sean Chittenden 2003-04-17 21:55:31 Re: [HACKERS] Are we losing momentum?