Re: Transactions in user defined function - Mailing list pgsql-general

From Grzegorz Jaśkiewicz
Subject Re: Transactions in user defined function
Date
Msg-id 2f4958ff0903130741m45a14616w21f81bf4ada4576c@mail.gmail.com
Whole thread Raw
In response to Transactions in user defined function  (Jasid ZA <za.jasid@gmail.com>)
Responses Re: Transactions in user defined function  (Tino Wildenhain <tino@wildenhain.de>)
List pgsql-general
On Fri, Mar 13, 2009 at 12:03 PM, Jasid ZA <za.jasid@gmail.com> wrote:
> Hi,
>
> Can we use sql transaction(BEGIN, COMMIT, REVOKE) inside a user defined
> function in Postgresql 8.3?
>
> looking forward to hear from you

Nope.
If function does something naughty - do RAISE EXCEPTION, that will
break transaction and query (hence rollback).
Please notice, that in plpgsql function uses BEGIN and END, and those
are precisely there to start and end transaction.
You cannot also change transaction level in function, it has to be
done on 'upper' level.

hth.


--
GJ

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Inserting string with a " into an array using {} syntax ... possible?
Next
From: Tino Wildenhain
Date:
Subject: Re: Transactions in user defined function