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 2361FD1B17A for ; Wed, 16 Jun 2004 23:02:09 -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 28710-09 for ; Thu, 17 Jun 2004 02:02:07 +0000 (GMT) Received: from mr1.surnet.cl (av1.surnet.cl [216.155.73.168]) by svr1.postgresql.org (Postfix) with ESMTP id CCFD4D1B8EB for ; Wed, 16 Jun 2004 23:02:02 -0300 (ADT) Received: from smtp1.surnet.cl (216.155.73.168) by mr1.surnet.cl (7.0.024) id 403F6D2501A0A93E; Wed, 16 Jun 2004 22:01:17 -0400 Received: from av2.surnet.cl ([216.155.73.169]) by smtp1.surnet.cl (MailMonitor for SMTP v1.2.2 ) ; Wed, 16 Jun 2004 22:01:16 -0400 (CLT) Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl (7.0.024) id 406CA66901662F6C; Wed, 16 Jun 2004 22:00:09 -0400 Received: from 216.155.88.75.dsl.surnet.cl (200.85.205.9) by cluster.surnet.cl (7.0.024) (authenticated as alvherre@surnet.cl) id 403C729000B6FDE5; Wed, 16 Jun 2004 22:01:19 -0400 Received: by 216.155.88.75.dsl.surnet.cl (Postfix, from userid 500) id 0EBB6134CD; Wed, 16 Jun 2004 22:01:18 -0400 (CLT) Date: Wed, 16 Jun 2004 22:01:17 -0400 From: Alvaro Herrera To: Christopher Kings-Lynne Cc: Bruce Momjian , Barry Lind , simon@2ndquadrant.com, Patches Subject: Re: Nested transactions Message-ID: <20040617020117.GC5925@dcc.uchile.cl> References: <200406170136.i5H1aX727064@candle.pha.pa.us> <40D0FB7C.8030309@familyhealth.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <40D0FB7C.8030309@familyhealth.com.au> User-Agent: Mutt/1.5.5.1i 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/221 X-Sequence-Number: 11444 On Thu, Jun 17, 2004 at 10:01:32AM +0800, Christopher Kings-Lynne wrote: > >And consider this case: > > > > BEGIN; > > ... > > SAVEPOINT x; > > SELECT func_call(); > > SELECT func_call(); > > COMMIT; > > > >Now if func_call has a savepoint, it is really nested because it can't > >know whether the savepoint X will be used to roll back, so its status is > >dependent on the status of X. Now, if we used savepoints in func_call, > >what happens in the second function call when we define a savepoint with > >the same name? I assume we overwrite the original, but using nested > >transaction syntax seems much clearer. > > It also seems in this example that func_call() probably shouldn't have > permission to rollback to savepoint x? Otherwise it would get...weird. 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. -- Alvaro Herrera () "Cuando maņana llegue pelearemos segun lo que maņana exija" (Mowgli)