Re: savepoints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux