]> begriffs open source - ai-pg/blob - full-docs/html/spi-transaction.html
Include links to all subsection html pages, with shorter paths too
[ai-pg] / full-docs / html / spi-transaction.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!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>45.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 Vsnapshot" /><link rel="prev" href="spi-spi-freeplan.html" title="SPI_freeplan" /><link rel="next" href="spi-spi-commit.html" title="SPI_commit" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">45.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 45. Server Programming Interface">Up</a></td><th width="60%" align="center">Chapter 45. Server Programming Interface</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 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 /></div><div class="sect1" id="SPI-TRANSACTION"><div class="titlepage"><div><div><h2 class="title" style="clear: both">45.4. Transaction Management <a href="#SPI-TRANSACTION" class="id_link">#</a></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"> — obsolete function</span></dt></dl></div><p>
3    It is not possible to run transaction control commands such
4    as <code class="command">COMMIT</code> and <code class="command">ROLLBACK</code> through SPI
5    functions such as <code class="function">SPI_execute</code>.  There are, however,
6    separate interface functions that allow transaction control through SPI.
7   </p><p>
8    It is not generally safe and sensible to start and end transactions in
9    arbitrary user-defined SQL-callable functions without taking into account
10    the context in which they are called.  For example, a transaction boundary
11    in the middle of a function that is part of a complex SQL expression that
12    is part of some SQL command will probably result in obscure internal errors
13    or crashes.  The interface functions presented here are primarily intended
14    to be used by procedural language implementations to support transaction
15    management in SQL-level procedures that are invoked by the <code class="command">CALL</code>
16    command, taking the context of the <code class="command">CALL</code> invocation into
17    account.  SPI-using procedures implemented in C can implement the same logic, but
18    the details of that are beyond the scope of this documentation.
19   </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" title="SPI_freeplan">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spi.html" title="Chapter 45. Server Programming Interface">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="spi-spi-commit.html" title="SPI_commit">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" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> SPI_commit</td></tr></table></div></body></html>