pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ROLLBACK, SAVEPOINT, COMMIT throwing error in transaction block.
2+ messages / 2 participants
[nested] [flat]

* ROLLBACK, SAVEPOINT, COMMIT throwing error in transaction block.
@ 2011-02-18 09:03 Jaiswal Dhaval Sudhirkumar <JaiswalDS@microland.com>
  2011-02-18 14:48 ` Re: ROLLBACK, SAVEPOINT, COMMIT throwing error in transaction block. Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Jaiswal Dhaval Sudhirkumar @ 2011-02-18 09:03 UTC (permalink / raw)
  To: pgsql-bugs

Hi List, 

Below function throwing error when i execute it on PostgreSQL 9.0. 

ERROR: SPI_execute_plan_with_paramlist failed executing query "SAVEPOINT my_savepoint": SPI_ERROR_TRANSACTION

CONTEXT: PL/pgSQL function "rlbk" line 5 at SQL statement

 

I searched and found that it is reported to pgsql-bugs. Can  you please let me know whether this bug has fixed or not. 

 

CREATE OR REPLACE FUNCTION rlbk(integer) RETURNS integer AS
$BODY$

DECLARE

bal_amt ALIAS FOR $1;

BEGIN

UPDATE accounts SET balance = balance - bal_amt WHERE name = 'Axis'; 

SAVEPOINT my_savepoint; 

UPDATE accounts SET balance = balance + bal_amt WHERE name = 'Bob'; 

ROLLBACK TO my_savepoint; 

UPDATE accounts SET balance = balance + bal_amt WHERE name = 'Wally'; 

COMMIT;

return bal_amt;

end;

$BODY$
LANGUAGE 'plpgsql';

 
--
Thanks & Regards
Dhaval Jaiswal | 
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. 
Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon,this information by persons or entities other than the intended recipient is prohibited. 
If you received this in error, please contact the sender and delete the material from your computer. 
Microland takes all reasonable steps to ensure that its electronic communications are free from viruses. 
However, given Internet accessibility, the Company cannot accept liability for any virus introduced by this e-mail or any attachment and you are advised to use up-to-date virus checking software. 

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ROLLBACK, SAVEPOINT, COMMIT throwing error in transaction block.
  2011-02-18 09:03 ROLLBACK, SAVEPOINT, COMMIT throwing error in transaction block. Jaiswal Dhaval Sudhirkumar <JaiswalDS@microland.com>
@ 2011-02-18 14:48 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2011-02-18 14:48 UTC (permalink / raw)
  To: Jaiswal Dhaval Sudhirkumar <JaiswalDS@microland.com>; +Cc: pgsql-bugs

"Jaiswal Dhaval Sudhirkumar" <JaiswalDS@microland.com> writes:
> ERROR: SPI_execute_plan_with_paramlist failed executing query "SAVEPOINT my_savepoint": SPI_ERROR_TRANSACTION

This is not a bug.  It's an extremely well-documented limitation that
you can't use those commands in a plpgsql function.

You can get the effect of a savepoint using a BEGIN/EXCEPTION block.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-02-18 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18 09:03 ROLLBACK, SAVEPOINT, COMMIT throwing error in transaction block. Jaiswal Dhaval Sudhirkumar <JaiswalDS@microland.com>
2011-02-18 14:48 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox