Re: Nested transactions - Mailing list pgsql-patches

From Tom Lane
Subject Re: Nested transactions
Date
Msg-id 20920.1087573090@sss.pgh.pa.us
Whole thread Raw
In response to Re: Nested transactions  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-patches
Alvaro Herrera <alvherre@dcc.uchile.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

pgsql-patches by date:

Previous
From: Gavin Sherry
Date:
Subject: Re: Tablespace patch review
Next
From: Tom Lane
Date:
Subject: Re: Nested transactions