CALL 执行事务控制语句

CALL executing transaction control statements

这一段关于在 postgresql 中调用是什么意思? 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.

这意味着如果您想在过程中使用 COMMITROLLBACK,则 CALL 语句不能成为显式启动事务的一部分。

这会失败:

BEGIN;
CALL myproc();
COMMIT;

但是没有调用BEGINCOMMIT,所以CALL语句在它自己的事务中运行,它会起作用。