Skip site navigation (1) Skip section navigation (2)

subtransactions -- storage manager

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: subtransactions -- storage manager
Date: 2004-04-25 18:06:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches

This patch adds subtransaction support into the storage manager.  Files
created or dropped inside a subtransaction are correctly dealt with at
subtransaction commit or abort.

This works:
create table foo (a int);
create table foo2 (a int);
		create table bar (a int);
		select relfilenode, relname from pg_class where relname in ('foo', 'bar');
		drop table foo2;
	drop table foo;
	create table baz (a int);
	select relfilenode, relname from pg_class where relname='baz';

At this point, the files for "bar" and "foo" have disappeared, while
"foo2" and "baz" remain.  (Note however that the catalog entries are not
correct -- this is because we don't have correctly recorded results in

While making this I realized I had made a mistake regarding portal
memory, so I also correct it with this patch.  As a side effect, the
following works;

		declare foo cursor for select 1;
		declare bar cursor for select 1;
	fetch all from foo;		-- returns 1 row
	fetch all from bar;		-- no such cursor

(This patch will only apply cleanly with the previous patch applied.)

Still missing:

- support for prepared statements, async notifies.  Easy.
- support for on commit actions.  Not sure.
- support for deferred triggers.  Not so easy, maybe hard.
- correct LWLock handling.  Should be easy (release them all on abort)
- correct regular lock handling.  Not so easy.
- pg_clog/pg_subtrans.  Need a solution.

PS: somehow I managed to get tired of the phrase "nested transactions"
and I'm using the term "subtransactions" instead.  In my head they are
the same thing ...

Alvaro Herrera (<alvherre[a]>)
Hi! I'm a .signature virus!
cp me into your .signature file to help me spread!


pgsql-patches by date

Next:From: Neil ConwayDate: 2004-04-25 18:41:14
Subject: Re: Remove traces of xfunc
Previous:From: Alvaro HerreraDate: 2004-04-25 04:43:38
Subject: Re: Remove traces of xfunc

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group