Alvaro, is this ready to be applied?
---------------------------------------------------------------------------
Alvaro Herrera wrote:
> Hackers,
>
> 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);
> begin;
> begin;
> create table bar (a int);
> select relfilenode, relname from pg_class where relname in ('foo', 'bar');
> drop table foo2;
> rollback;
> drop table foo;
> create table baz (a int);
> select relfilenode, relname from pg_class where relname='baz';
> commit;
>
> 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
> pg_clog.)
>
> 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;
>
> begin;
> begin;
> declare foo cursor for select 1;
> commit;
> begin;
> declare bar cursor for select 1;
> rollback;
> fetch all from foo; -- returns 1 row
> fetch all from bar; -- no such cursor
> rollback;
>
> (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]dcc.uchile.cl>)
> Hi! I'm a .signature virus!
> cp me into your .signature file to help me spread!
[ Attachment, skipping... ]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073