Skip site navigation (1) Skip section navigation (2)

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

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: "Yogaraj(dot) C" <c_yog(at)rediffmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1971: Start Transaction is giving Errors !!!
Date: 2005-10-18 14:30:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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

"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:

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

In response to

pgsql-bugs by date

Next:From: Alvaro HerreraDate: 2005-10-18 14:32:55
Subject: Re: BUG #1971: Start Transaction is giving Errors !!!
Previous:From: Richard HuxtonDate: 2005-10-18 13:15:53
Subject: Re: BUG #1972: index error with space character

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group