X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 133A011F68D9 for ; Wed, 12 Apr 2006 14:29:55 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 1.458 X-Spam-Level: * X-Spam-Status: No, score=1.458 required=5 tests=[AWL=-0.461, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id ELrYweZ7lcE1 for ; Wed, 12 Apr 2006 14:29:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx2.surnet.cl (mx2.surnet.cl [216.155.73.181]) by postgresql.org (Postfix) with ESMTP id 853BF11F675E for ; Wed, 12 Apr 2006 14:29:49 -0300 (ADT) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 12 Apr 2006 13:29:48 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AQAAAE6QIkSICgIC X-IronPort-AV: i="4.02,198,1139194800"; d="scan'208"; a="42601658:sNHT19015904" Received: from alvh.no-ip.org (201.221.200.14) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 443B7DDC0003CF0E; Wed, 12 Apr 2006 13:29:48 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id C4F9EC2DC22; Wed, 12 Apr 2006 13:29:47 -0400 (CLT) Date: Wed, 12 Apr 2006 13:29:47 -0400 From: Alvaro Herrera To: Sriram Dandapani Cc: pgsql-admin@postgresql.org Subject: Re: savepoints Message-ID: <20060412172947.GF26756@surnet.cl> Mail-Followup-To: Sriram Dandapani , pgsql-admin@postgresql.org References: <6992E470F12A444BB787B5C937B9D4DF03EF4740@ca-mail1.cis.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF03EF4740@ca-mail1.cis.local> User-Agent: Mutt/1.5.11+cvs20060330 X-Archive-Number: 200604/112 X-Sequence-Number: 21281 Sriram Dandapani wrote: > This is the scenario: > > > > Controller function fncCtrl calls function A, function B and function C > in that order. > > Function A needs a savepoint to prevent errors from undoing work that > needs to be committed regardless of errors in function B or C > > Is there a way to define a generic savepoint that any errors in B or C > will rollback to. What you can do is to have fncCtrl like this: BEGIN perform A(); BEGIN perform B(); perform C(); EXCEPTION WHEN ... -- here, either B or C failed END END If B or C fail, the changes made by A will persist. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.