1<!--
2doc/src/sgml/ref/end.sgml
3PostgreSQL documentation
4-->
5
6<refentry id="sql-end">
7 <indexterm zone="sql-end">
8  <primary>END</primary>
9 </indexterm>
10
11 <refmeta>
12  <refentrytitle>END</refentrytitle>
13  <manvolnum>7</manvolnum>
14  <refmiscinfo>SQL - Language Statements</refmiscinfo>
15 </refmeta>
16
17 <refnamediv>
18  <refname>END</refname>
19  <refpurpose>commit the current transaction</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23<synopsis>
24END [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
25</synopsis>
26 </refsynopsisdiv>
27
28 <refsect1>
29  <title>Description</title>
30
31  <para>
32   <command>END</command> commits the current transaction. All changes
33   made by the transaction become visible to others and are guaranteed
34   to be durable if a crash occurs.  This command is a
35   <productname>PostgreSQL</productname> extension
36   that is equivalent to <xref linkend="sql-commit"/>.
37  </para>
38 </refsect1>
39
40 <refsect1>
41  <title>Parameters</title>
42
43  <variablelist>
44   <varlistentry>
45    <term><literal>WORK</literal></term>
46    <term><literal>TRANSACTION</literal></term>
47    <listitem>
48     <para>
49      Optional key words. They have no effect.
50     </para>
51    </listitem>
52   </varlistentry>
53
54   <varlistentry>
55    <term><literal>AND CHAIN</literal></term>
56    <listitem>
57     <para>
58      If <literal>AND CHAIN</literal> is specified, a new transaction is
59      immediately started with the same transaction characteristics (see <xref
60      linkend="sql-set-transaction"/>) as the just finished one.  Otherwise,
61      no new transaction is started.
62     </para>
63    </listitem>
64   </varlistentry>
65  </variablelist>
66 </refsect1>
67
68 <refsect1>
69  <title>Notes</title>
70
71  <para>
72   Use <xref linkend="sql-rollback"/> to
73   abort a transaction.
74  </para>
75
76  <para>
77   Issuing <command>END</command> when not inside a transaction does
78   no harm, but it will provoke a warning message.
79  </para>
80 </refsect1>
81
82 <refsect1>
83  <title>Examples</title>
84
85  <para>
86   To commit the current transaction and make all changes permanent:
87<programlisting>
88END;
89</programlisting></para>
90 </refsect1>
91
92 <refsect1>
93  <title>Compatibility</title>
94
95  <para>
96   <command>END</command> is a <productname>PostgreSQL</productname>
97   extension that provides functionality equivalent to <xref
98   linkend="sql-commit"/>, which is
99   specified in the SQL standard.
100  </para>
101 </refsect1>
102
103 <refsect1>
104  <title>See Also</title>
105
106  <simplelist type="inline">
107   <member><xref linkend="sql-begin"/></member>
108   <member><xref linkend="sql-commit"/></member>
109   <member><xref linkend="sql-rollback"/></member>
110  </simplelist>
111 </refsect1>
112</refentry>
113