1<!--
2doc/src/sgml/ref/commit.sgml
3PostgreSQL documentation
4-->
5
6<refentry id="SQL-COMMIT">
7 <indexterm zone="sql-commit">
8  <primary>COMMIT</primary>
9 </indexterm>
10
11 <refmeta>
12  <refentrytitle>COMMIT</refentrytitle>
13  <manvolnum>7</manvolnum>
14  <refmiscinfo>SQL - Language Statements</refmiscinfo>
15 </refmeta>
16
17 <refnamediv>
18  <refname>COMMIT</refname>
19  <refpurpose>commit the current transaction</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23<synopsis>
24COMMIT [ WORK | TRANSACTION ]
25</synopsis>
26 </refsynopsisdiv>
27
28 <refsect1>
29  <title>Description</title>
30
31  <para>
32   <command>COMMIT</command> commits the current transaction. All
33   changes made by the transaction become visible to others
34   and are guaranteed to be durable if a crash occurs.
35  </para>
36 </refsect1>
37
38 <refsect1>
39  <title>Parameters</title>
40
41  <variablelist>
42   <varlistentry>
43    <term><literal>WORK</literal></term>
44    <term><literal>TRANSACTION</literal></term>
45    <listitem>
46     <para>
47      Optional key words. They have no effect.
48     </para>
49    </listitem>
50   </varlistentry>
51  </variablelist>
52 </refsect1>
53
54 <refsect1>
55  <title>Notes</title>
56
57  <para>
58   Use <xref linkend="SQL-ROLLBACK"> to
59   abort a transaction.
60  </para>
61
62  <para>
63   Issuing <command>COMMIT</> when not inside a transaction does
64   no harm, but it will provoke a warning message.
65  </para>
66 </refsect1>
67
68 <refsect1>
69  <title>Examples</title>
70
71  <para>
72   To commit the current transaction and make all changes permanent:
73<programlisting>
74COMMIT;
75</programlisting></para>
76 </refsect1>
77
78 <refsect1>
79  <title>Compatibility</title>
80
81  <para>
82   The SQL standard only specifies the two forms
83   <literal>COMMIT</literal> and <literal>COMMIT
84   WORK</literal>. Otherwise, this command is fully conforming.
85  </para>
86 </refsect1>
87
88 <refsect1>
89  <title>See Also</title>
90
91  <simplelist type="inline">
92   <member><xref linkend="sql-begin"></member>
93   <member><xref linkend="sql-rollback"></member>
94  </simplelist>
95 </refsect1>
96</refentry>
97