pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Scott Petersen <scottpetersen@softhome.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Savepoint/Rollback in functions
Date: Tue, 14 Mar 2006 19:11:18 -0400
Message-ID: <20060314231118.GB8263@surnet.cl> (raw)
In-Reply-To: <4417469C.8020600@softhome.net>
References: <4417469C.8020600@softhome.net>

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.



view thread (2+ messages)

Message-ID: <20060314231118.GB8263@surnet.cl>
Permalink:  ../20060314231118.GB8263@surnet.cl/
Also on:    postgresql.org/message-id/20060314231118.GB8263@surnet.cl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alvherre@commandprompt.com, scottpetersen@softhome.net
  Subject: Re: Savepoint/Rollback in functions
  In-Reply-To: <20060314231118.GB8263@surnet.cl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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