Re: Transactions in user defined function

From: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
To: Jasid ZA <za(dot)jasid(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Transactions in user defined function
Date: 2009-03-13 14:41:49
Message-ID: 2f4958ff0903130741m45a14616w21f81bf4ada4576c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 13, 2009 at 12:03 PM, Jasid ZA <za(dot)jasid(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2009-03-13 14:43:53 Re: Transactions in user defined function
Previous Message Bill Moran 2009-03-13 14:21:56 Re: Inserting string with a " into an array using {} syntax ... possible?