dbTalk Databases Forums  

[BUGS] BUG #1971: Start Transaction is giving Errors !!!

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1971: Start Transaction is giving Errors !!! in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Yogaraj. C
 
Posts: n/a

Default [BUGS] BUG #1971: Start Transaction is giving Errors !!! - 10-18-2005 , 07:56 AM







The following bug has been logged online:

Bug reference: 1971
Logged by: Yogaraj. C
Email address: c_yog (AT) rediffmail (DOT) com
PostgreSQL version: 7.4.8
Operating system: Linux - Red Hat 9
Description: Start Transaction is giving Errors !!!
Details:

Hi,

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

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

Yogaraj.C

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply With Quote
  #2  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] BUG #1971: Start Transaction is giving Errors !!! - 10-18-2005 , 09:36 AM






On Mon, Oct 17, 2005 at 12:50:29PM +0100, Yogaraj. C wrote:
Quote:
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/i...structure.html

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

Quote:
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/i...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

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #3  
Old   
Alvaro Herrera
 
Posts: n/a

Default Re: [BUGS] BUG #1971: Start Transaction is giving Errors !!! - 10-18-2005 , 09:38 AM



Yogaraj. C wrote:

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

If anyone know the solution for this, pleas help me.
NOTABUG. You are not allowed to use transaction commands using SPI,
which in particular means PL/pgSQL. Use the EXCEPTION clause if you
need a savepoint-like feature. Note that you can't close the
transaction that started the function.

--
Alvaro Herrera http://www.amazon.com/gp/registry/DXLWNGRJD34
"El sudor es la mejor cura para un pensamiento enfermo" (Bardia)

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.