X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 93C18D1B241 for ; Fri, 18 Jun 2004 12:39:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28619-05 for ; Fri, 18 Jun 2004 15:38:56 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D6580D1B1EC for ; Fri, 18 Jun 2004 12:38:55 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i5IFcAZH020921; Fri, 18 Jun 2004 11:38:11 -0400 (EDT) To: Alvaro Herrera Cc: Christopher Kings-Lynne , Bruce Momjian , Barry Lind , simon@2ndquadrant.com, Patches Subject: Re: Nested transactions In-reply-to: <20040617020117.GC5925@dcc.uchile.cl> References: <200406170136.i5H1aX727064@candle.pha.pa.us> <40D0FB7C.8030309@familyhealth.com.au> <20040617020117.GC5925@dcc.uchile.cl> Comments: In-reply-to Alvaro Herrera message dated "Wed, 16 Jun 2004 22:01:17 -0400" Date: Fri, 18 Jun 2004 11:38:10 -0400 Message-ID: <20920.1087573090@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/239 X-Sequence-Number: 11462 Alvaro Herrera 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