Skip site navigation (1) Skip section navigation (2)

Re: transaction in function

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: transaction in function
Date: 2006-12-05 16:23:19
Message-ID: 20061205162319.GB11315@a-kretschmer.de (view raw or flat)
Thread:
Lists: pgsql-sql
am  Tue, dem 05.12.2006, um 16:25:31 +0100 mailte Marian POPESCU folgendes:
> Hi,
> 
> I want to write a function that updates several tables; if there is an
> exception while updating, it should rollback the transaction and raise an
> error.
> 
> How can this be done in pgPLSQL in PostgreSQL 8.1 ?

A function runs within a transaction. You can trapp errors within a
function, read this:

http://www.postgresql.org/docs/8.1/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

In response to

pgsql-sql by date

Next:From: Tom LaneDate: 2006-12-05 16:57:12
Subject: Re: transaction in function
Previous:From: Marian POPESCUDate: 2006-12-05 15:25:31
Subject: transaction in function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group