Trouble with Savepoints in postgres - Mailing list pgsql-general

From sam
Subject Trouble with Savepoints in postgres
Date
Msg-id a4b44ce8-423c-4844-8d93-fec99728f582@i29g2000prf.googlegroups.com
Whole thread Raw
Responses Re: Trouble with Savepoints in postgres
List pgsql-general
Iam not able to use savepoints i postgres.
Iam using version 8.2.
If i write something like this :
CREATE OR REPLACE FUNCTION test_savepoint()
  RETURNS void AS
$BODY$
DECLARE

BEGIN
SAVEPOINT foo;
    INSERT INTO table1 VALUES (3);

   INSERT INTO table1 VALUES (4);
    ROLLBACK TO foo;
COMMIT;

END;

$BODY$
  LANGUAGE 'plpgsql' VOLATILE;


when i try to excute this function it throws me an error:
ERROR: SPI_execute_plan failed executing query "SAVEPOINT foo":
SPI_ERROR_TRANSACTION
SQL state: XX000

Iam not able to understand if this is a version problem or the way iam
using savepoints is wrong.Please advice.

Thanks
Sam

pgsql-general by date:

Previous
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: Trigger to run @ connection time?
Next
From: Tom Lane
Date:
Subject: Re: ERROR: text search configuration "pg_catalog.english" does not exist