diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/plpgsql.sgml | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 7ed926fd51e..b63b8496c7b 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -3463,9 +3463,9 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>; <title>Transaction Management</title> <para> - In procedures invoked by the <command>CALL</command> command from the top - level as well as in anonymous code blocks (<command>DO</command> command) - called from the top level, it is possible to end transactions using the + In procedures invoked by the <command>CALL</command> command + as well as in anonymous code blocks (<command>DO</command> command), + it is possible to end transactions using the commands <command>COMMIT</command> and <command>ROLLBACK</command>. A new transaction is started automatically after a transaction is ended using these commands, so there is no separate <command>START @@ -3496,6 +3496,20 @@ CALL transaction_test1(); </para> <para> + Transaction control is only possible in <command>CALL</command> or + <command>DO</command> invocations from the top level or nested + <command>CALL</command> or <command>DO</command> invocations without any + other intervening command. For example, if the call stack is + <command>CALL proc1()</command> → <command>CALL proc2()</command> + → <command>CALL proc3()</command>, then the second and third + procedures can perform transaction control actions. But if the call stack + is <command>CALL proc1()</command> → <command>SELECT + func2()</command> → <command>CALL proc3()</command>, then the last + procedure cannot do transaction control, because of the + <command>SELECT</command> in between. + </para> + + <para> A transaction cannot be ended inside a loop over a query result, nor inside a block with exception handlers. </para> |