Re: Nested transactions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Barry Lind <blind(at)xythos(dot)com>, simon(at)2ndquadrant(dot)com, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Nested transactions
Date: 2004-06-18 15:38:10
Message-ID: 20920.1087573090@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches

Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> writes:
> I don't think we should explicitly forbid it. I think it should be
> forbidden to close the outermost transaction inside a function (else the
> function would not be able to terminate correctly), but for levels
> before that one it'd be OK.

More specifically, a function cannot close any xact that was open when
it was called. It can only close xacts that it started (or
equivalently, roll back to savepoints that it established). Otherwise
the behavior is nonsensical. Rollback of an outer transaction would
mean making like the function call never even happened, so the function
certainly couldn't expect to keep control.

regards, tom lane

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-06-18 16:30:17 Re: JDK 1.5 beta2 and generics
Previous Message Paul Balanoiu 2004-06-18 15:33:53 Re: unsubscribe

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-06-18 16:32:52 Re: Nested transactions
Previous Message Gavin Sherry 2004-06-18 07:02:58 Re: Tablespace patch review