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)