Re: Savepoint/Rollback in functions - Mailing list pgsql-sql

From Alvaro Herrera
Subject Re: Savepoint/Rollback in functions
Date
Msg-id 20060314231118.GB8263@surnet.cl
Whole thread Raw
In response to Savepoint/Rollback in functions  (Scott Petersen <scottpetersen@softhome.net>)
List pgsql-sql
Scott Petersen wrote:

Hi,

> Question 1:  does pg/psql functions allow "SAVEPOINT/ROLLBACK" 
> functionality? (if so how?)

Yes.  However, you cannot use that syntax directly.  You rather use it
by establishing EXCEPTION clauses in BEGIN/END blocks.  Upon entering
any BEGIN/END block which has an EXCEPTION clause, an implicit SAVEPOINT
is executed.  If any exception (read: error) is found while executing
the block, the savepoint will be automatically rolled back and control
passed to the EXCEPTION block.

HTH,

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-sql by date:

Previous
From: Scott Petersen
Date:
Subject: Savepoint/Rollback in functions
Next
From: John DeSoi
Date:
Subject: Re: Copying a row within table