commit.sgml 2.09 KB
Newer Older
1
<!--
2
$PostgreSQL: pgsql/doc/src/sgml/ref/commit.sgml,v 1.20 2006/09/16 00:30:17 momjian Exp $
3
PostgreSQL documentation
4 5
-->

6 7
<refentry id="SQL-COMMIT">
 <refmeta>
8
  <refentrytitle id="SQL-COMMIT-TITLE">COMMIT</refentrytitle>
9 10
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>
11

12
 <refnamediv>
13 14
  <refname>COMMIT</refname>
  <refpurpose>commit the current transaction</refpurpose>
15 16
 </refnamediv>

Peter Eisentraut's avatar
Peter Eisentraut committed
17 18 19 20
 <indexterm zone="sql-commit">
  <primary>COMMIT</primary>
 </indexterm>

21
 <refsynopsisdiv>
22
<synopsis>
23
COMMIT [ WORK | TRANSACTION ]
24
</synopsis>
25
 </refsynopsisdiv>
26
  
27 28 29
 <refsect1>
  <title>Description</title>

30
  <para>
31
   <command>COMMIT</command> commits the current transaction. All
32 33
   changes made by the transaction become visible to others
   and are guaranteed to be durable if a crash occurs.
34
  </para>
35
 </refsect1>
36
  
37 38
 <refsect1>
  <title>Parameters</title>
39

40 41 42 43 44 45 46 47 48 49 50
  <variablelist>
   <varlistentry>
    <term><literal>WORK</literal></term>
    <term><literal>TRANSACTION</literal></term>
    <listitem>
     <para>
      Optional key words. They have no effect.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
51
 </refsect1>
52 53 54

 <refsect1>
  <title>Notes</title>
55

56
  <para>
57 58 59
   Use <xref linkend="SQL-ROLLBACK" endterm="SQL-ROLLBACK-TITLE"> to
   abort a transaction.
  </para>
60 61 62 63 64

  <para>
   Issuing <command>COMMIT</> when not inside a transaction does
   no harm, but it will provoke a warning message.
  </para>
65 66 67 68 69 70 71 72 73 74
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   To commit the current transaction and make all changes permanent:
<programlisting>
COMMIT;
</programlisting>
75 76
  </para>
 </refsect1>
77

78 79
 <refsect1>
  <title>Compatibility</title>
80
  
81 82 83 84 85
  <para>
   The SQL standard only specifies the two forms
   <literal>COMMIT</literal> and <literal>COMMIT
   WORK</literal>. Otherwise, this command is fully conforming.
  </para>
86
 </refsect1>
87 88 89 90 91 92 93 94 95

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-begin" endterm="sql-begin-title"></member>
   <member><xref linkend="sql-rollback" endterm="sql-rollback-title"></member>
  </simplelist>
 </refsect1>
96
</refentry>