Re: Transactions in user defined function

Поиск
Список
Период
Сортировка
От Tino Wildenhain
Тема Re: Transactions in user defined function
Дата
Msg-id 49BA716A.5030804@wildenhain.de
обсуждение исходный текст
Ответ на Re: Transactions in user defined function  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Список pgsql-general
Grzegorz Jaśkiewicz wrote:
> 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.

Sorry, they are not:

"It is important not to confuse the use of BEGIN/END for grouping
statements in PL/pgSQL with the similarly-named SQL commands for
transaction control. PL/pgSQL's BEGIN/END are only for grouping; they do
not start or end a transaction."

Regards
Tino


Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Tino Wildenhain
Дата:
Сообщение: Re: Transactions in user defined function
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Inserting string with a " into an array using {} syntax ... possible?