Hi,

I have the following code in a function which has a savepoint so that I can rollback all the changes made.

BEGIN
SAVEPOINT my_savepoint;
INSERT INTO
staging_omnipay.crx_mp
(merch_id,merch_id_sht,import_number)
VALUES
(1235,1235,1);
ROLLBACK TO SAVEPOINT my_savepoint;
END;

But everytime I try to run this function I get the following error:

ERROR: cannot begin/end transactions in PL/pgSQL
HINT: Use a BEGIN block with an EXCEPTION clause instead.
CONTEXT: PL/pgSQL function "function2" line 3 at SQL statement

Any idea?