Arcil Tralleis
Arcil Tralleis

Reputation: 131

CALL executing transaction control statements

What does this paragraph mean about call In postrgesql ? source:

If CALL is executed in a transaction block, then the called procedure cannot execute transaction control statements. Transaction control statements are only allowed if CALL is executed in its own transaction.

Upvotes: 2

Views: 184

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247950

That means that the CALL statement cannot be part of an explicitly started transaction if you want to use COMMIT or ROLLBACK inside the procedure.

This will fail:

BEGIN;
CALL myproc();
COMMIT;

But called without BEGIN and COMMIT, so that the CALL statement runs in its own transaction, it will work.

Upvotes: 1

Related Questions