Re: BUG #1971: Start Transaction is giving Errors !!!

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: BUG #1971: Start Transaction is giving Errors !!!
Дата
Msg-id 20051018143004.GA77948@winnie.fuhr.org
обсуждение исходный текст
Ответ на BUG #1971: Start Transaction is giving Errors !!!  ("Yogaraj. C" <c_yog@rediffmail.com>)
Список pgsql-bugs
On Mon, Oct 17, 2005 at 12:50:29PM +0100, Yogaraj. C wrote:
>    When I was executing the procedure (with Transaction), postgres will
> producing the following error.
>
> ERROR:  SPI_prepare() failed on "START TRANSACTION"
> CONTEXT:  PL/pgSQL function "sp_example1" line 4 at SQL statement

http://www.postgresql.org/docs/7.4/interactive/plpgsql-structure.html

"Functions and trigger procedures are always executed within a
transaction established by an outer query --- they cannot start or
commit transactions...."

>    If anyone know the solution for this, pleas help me.

What problem are you trying to solve?  PostgreSQL 8.0 introduced
savepoints, which you can use in PL/pgSQL via an EXCEPTION clause:

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

Another possibility might be to use dblink to make another connection
to the database from within the function and execute transactions
over that connection.

--
Michael Fuhr

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: BUG #1972: index error with space character
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #1971: Start Transaction is giving Errors !!!