<!--
doc/src/sgml/ref/release_savepoint.sgml
PostgreSQL documentation
-->
<refentry id="sql-release-savepoint">
<indexterm zone="sql-release-savepoint">
<primary>RELEASE SAVEPOINT</primary>
</indexterm>
<indexterm zone="sql-release-savepoint">
<primary>savepoints</primary>
<secondary>releasing</secondary>
</indexterm>
<refmeta>
<refentrytitle>RELEASE SAVEPOINT</refentrytitle>
<manvolnum>7</manvolnum>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>RELEASE SAVEPOINT</refname>
<refpurpose>release a previously defined savepoint</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
RELEASE [ SAVEPOINT ] <replaceable>savepoint_name</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>RELEASE SAVEPOINT</command> releases the named savepoint and
all active savepoints that were created after the named savepoint,
and frees their resources. All changes made since the creation of
the savepoint that didn't already get rolled back are merged into
the transaction or savepoint that was active when the named savepoint
was created. Changes made after <command>RELEASE SAVEPOINT</command>
will also be part of this active transaction or savepoint.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable>savepoint_name</replaceable></term>
<listitem>
<para>
The name of the savepoint to release.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Notes</title>
<para>
Specifying a savepoint name that was not previously defined is an error.
</para>
<para>
It is not possible to release a savepoint when the transaction is in
an aborted state; to do that, use <xref linkend="sql-rollback-to"/>.
</para>
<para>
If multiple savepoints have the same name, only the most recently defined
unreleased one is released. Repeated commands will release progressively
older savepoints.
</para>
</refsect1>
<refsect1>
<title>Examples</title>