| The PostgreSQL 9.0 Reference Manual - Volume 2 - Programming Guide
by The PostgreSQL Global Development Group Paperback (6"x9"), 478 pages ISBN 9781906966065 RRP £14.95 ($19.95) Sales of this book support the PostgreSQL project! Get a printed copy>>> |
9.12.2.1 Implicit Rollback after Exceptions
In PL/pgSQL, when an exception is caught by an
EXCEPTION clause, all database changes since the block's
BEGIN are automatically rolled back. That is, the behavior
is equivalent to what you'd get in Oracle with:
BEGIN
SAVEPOINT s1;
... code here ...
EXCEPTION
WHEN ... THEN
ROLLBACK TO s1;
... code here ...
WHEN ... THEN
ROLLBACK TO s1;
... code here ...
END;
If you are translating an Oracle procedure that uses
SAVEPOINT and ROLLBACK TO in this style,
your task is easy: just omit the SAVEPOINT and
ROLLBACK TO. If you have a procedure that uses
SAVEPOINT and ROLLBACK TO in a different way
then some actual thought will be required.
| ISBN 9781906966065 | The PostgreSQL 9.0 Reference Manual - Volume 2 - Programming Guide | See the print edition |