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.

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to