2 45.4. Transaction Management #
4 SPI_commit — commit the current transaction
5 SPI_rollback — abort the current transaction
6 SPI_start_transaction — obsolete function
8 It is not possible to run transaction control commands such as COMMIT
9 and ROLLBACK through SPI functions such as SPI_execute. There are,
10 however, separate interface functions that allow transaction control
13 It is not generally safe and sensible to start and end transactions in
14 arbitrary user-defined SQL-callable functions without taking into
15 account the context in which they are called. For example, a
16 transaction boundary in the middle of a function that is part of a
17 complex SQL expression that is part of some SQL command will probably
18 result in obscure internal errors or crashes. The interface functions
19 presented here are primarily intended to be used by procedural language
20 implementations to support transaction management in SQL-level
21 procedures that are invoked by the CALL command, taking the context of
22 the CALL invocation into account. SPI-using procedures implemented in C
23 can implement the same logic, but the details of that are beyond the
24 scope of this documentation.