Nested transactions, 1st try - Mailing list pgsql-patches

From Alvaro Herrera
Subject Nested transactions, 1st try
Date
Msg-id 20030417225754.GA5370@dcc.uchile.cl
Whole thread Raw
List 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

pgsql-patches by date:

Previous
From: Sean Chittenden
Date:
Subject: Re: [HACKERS] Are we losing momentum?
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Are we losing momentum?