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