|
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>46.4. Transaction Management</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="spi-spi-freeplan.html" title="SPI_freeplan" /><link rel="next" href="spi-spi-commit.html" title="SPI_commit" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">46.4. Transaction Management</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="spi-spi-freeplan.html" title="SPI_freeplan">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="spi.html" title="Chapter 46. Server Programming Interface">Up</a></td><th width="60%" align="center">Chapter 46. Server Programming Interface</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="spi-spi-commit.html" title="SPI_commit">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="SPI-TRANSACTION"><div class="titlepage"><div><div><h2 class="title" style="clear: both">46.4. Transaction Management</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="refentrytitle"><a href="spi-spi-commit.html">SPI_commit</a></span><span class="refpurpose"> — commit the current transaction</span></dt><dt><span class="refentrytitle"><a href="spi-spi-rollback.html">SPI_rollback</a></span><span class="refpurpose"> — abort the current transaction</span></dt><dt><span class="refentrytitle"><a href="spi-spi-start-transaction.html">SPI_start_transaction</a></span><span class="refpurpose"> — start a new transaction</span></dt></dl></div><p>
- It is not possible to run transaction control commands such
- as <code class="command">COMMIT</code> and <code class="command">ROLLBACK</code> through SPI
- functions such as <code class="function">SPI_execute</code>. There are, however,
- separate interface functions that allow transaction control through SPI.
- </p><p>
- It is not generally safe and sensible to start and end transactions in
- arbitrary user-defined SQL-callable functions without taking into account
- the context in which they are called. For example, a transaction boundary
- in the middle of a function that is part of a complex SQL expression that
- is part of some SQL command will probably result in obscure internal errors
- or crashes. The interface functions presented here are primarily intended
- to be used by procedural language implementations to support transaction
- management in SQL-level procedures that are invoked by the <code class="command">CALL</code>
- command, taking the context of the <code class="command">CALL</code> invocation into
- account. SPI-using procedures implemented in C can implement the same logic, but
- the details of that are beyond the scope of this documentation.
- </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="spi-spi-freeplan.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spi.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="spi-spi-commit.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">SPI_freeplan </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> SPI_commit</td></tr></table></div></body></html>
|