pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedsavepoints
2+ messages / 2 participants
[nested] [flat]
* savepoints
@ 2006-04-12 17:22 Sriram Dandapani <sdandapani@counterpane.com>
2006-04-12 17:29 ` Re: savepoints Alvaro Herrera <alvherre@commandprompt.com>
0 siblings, 1 reply; 2+ messages in thread
From: Sriram Dandapani @ 2006-04-12 17:22 UTC (permalink / raw)
To: pgsql-admin
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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: savepoints
2006-04-12 17:22 savepoints Sriram Dandapani <sdandapani@counterpane.com>
@ 2006-04-12 17:29 ` Alvaro Herrera <alvherre@commandprompt.com>
0 siblings, 0 replies; 2+ messages in thread
From: Alvaro Herrera @ 2006-04-12 17:29 UTC (permalink / raw)
To: Sriram Dandapani <sdandapani@counterpane.com>; +Cc: pgsql-admin
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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-04-12 17:29 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-04-12 17:22 savepoints Sriram Dandapani <sdandapani@counterpane.com>
2006-04-12 17:29 ` Alvaro Herrera <alvherre@commandprompt.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox