Обсуждение: Can I make a function an explicit transaction within?

Поиск
Список
Период
Сортировка

Can I make a function an explicit transaction within?

От
Ivicz László
Дата:
Hi,
I have tried in 7.3 to make a PL/pgSQL function with an explicit Begin
Transaction; Rollback; and Commit;.
The editor allowed to save it (pgAdmin II), but each of the above
commands caused a
runtime error in any variation.
My question is: Can I make a function with explicit transaction in any
procedural language (mainly in PL/pgSQL)?
Thanks,
Laci


Re: Can I make a function an explicit transaction within?

От
Josh Berkus
Дата:
Laci,

> I have tried in 7.3 to make a PL/pgSQL function with an explicit Begin
> Transaction; Rollback; and Commit;.
> The editor allowed to save it (pgAdmin II), but each of the above
> commands caused a
> runtime error in any variation.
> My question is: Can I make a function with explicit transaction in any
> procedural language (mainly in PL/pgSQL)?

I'm afraid not.   In PostgreSQL, each function is by definition a transaction,
and Postgres does not yet support nested transactions.

--
-Josh Berkus
 Aglio Database Solutions
 San Francisco