| 1 |
<!-- |
| 2 |
doc/src/sgml/ref/start_transaction.sgml |
| 3 |
PostgreSQL documentation |
| 4 |
--> |
| 5 |
|
| 6 |
<refentry id="sql-start-transaction"> |
| 7 |
<indexterm zone="sql-start-transaction"> |
| 8 |
<primary>START TRANSACTION</primary> |
| 9 |
</indexterm> |
| 10 |
|
| 11 |
<refmeta> |
| 12 |
<refentrytitle>START TRANSACTION</refentrytitle> |
| 13 |
<manvolnum>7</manvolnum> |
| 14 |
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>START TRANSACTION</refname> |
| 19 |
<refpurpose>start a transaction block</refpurpose> |
| 20 |
</refnamediv> |
| 21 |
|
| 22 |
<refsynopsisdiv> |
| 23 |
<synopsis> |
| 24 |
START TRANSACTION [ <replaceable class="parameter">transaction_mode</replaceable> [, ...] ] |
| 25 |
|
| 26 |
<phrase>where <replaceable class="parameter">transaction_mode</replaceable> is one of:</phrase> |
| 27 |
|
| 28 |
ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED } |
| 29 |
READ WRITE | READ ONLY |
| 30 |
[ NOT ] DEFERRABLE |
| 31 |
</synopsis> |
| 32 |
</refsynopsisdiv> |
| 33 |
|
| 34 |
<refsect1> |
| 35 |
<title>Description</title> |
| 36 |
|
| 37 |
<para> |
| 38 |
This command begins a new transaction block. If the isolation level, |
| 39 |
read/write mode, or deferrable mode is specified, the new transaction has those |
| 40 |
characteristics, as if <link linkend="sql-set-transaction"><command>SET TRANSACTION</command></link> was executed. This is the same |
| 41 |
as the <link linkend="sql-begin"><command>BEGIN</command></link> command. |
| 42 |
</para> |
| 43 |
</refsect1> |
| 44 |
|
| 45 |
<refsect1> |
| 46 |
<title>Parameters</title> |
| 47 |
|
| 48 |
<para> |
| 49 |
Refer to <xref linkend="sql-set-transaction"/> for information on the meaning |
| 50 |
of the parameters to this statement. |
| 51 |
</para> |
| 52 |
</refsect1> |
| 53 |
|
| 54 |
<refsect1> |
| 55 |
<title>Compatibility</title> |
| 56 |
|
| 57 |
<para> |
| 58 |
In the standard, it is not necessary to issue <command>START TRANSACTION</command> |
| 59 |
to start a transaction block: any SQL command implicitly begins a block. |
| 60 |
<productname>PostgreSQL</productname>'s behavior can be seen as implicitly |
| 61 |
issuing a <command>COMMIT</command> after each command that does not |
| 62 |
follow <command>START TRANSACTION</command> (or <command>BEGIN</command>), |
| 63 |
and it is therefore often called <quote>autocommit</quote>. |
| 64 |
Other relational database systems might offer an autocommit feature |
| 65 |
as a convenience. |
| 66 |
</para> |
| 67 |
|
| 68 |
<para> |
| 69 |
The <literal>DEFERRABLE</literal> |
| 70 |
<replaceable class="parameter">transaction_mode</replaceable> |
| 71 |
is a <productname>PostgreSQL</productname> language extension. |
| 72 |
</para> |
| 73 |
|
| 74 |
<para> |
| 75 |
The SQL standard requires commas between successive <replaceable |
| 76 |
class="parameter">transaction_modes</replaceable>, but for historical |
| 77 |
reasons <productname>PostgreSQL</productname> allows the commas to be |
| 78 |
omitted. |
| 79 |
</para> |
| 80 |
|
| 81 |
<para> |
| 82 |
See also the compatibility section of <xref linkend="sql-set-transaction"/>. |
| 83 |
</para> |
| 84 |
</refsect1> |
| 85 |
|
| 86 |
<refsect1> |
| 87 |
<title>See Also</title> |
| 88 |
|
| 89 |
<simplelist type="inline"> |
| 90 |
<member><xref linkend="sql-begin"/></member> |
| 91 |
<member><xref linkend="sql-commit"/></member> |
| 92 |
<member><xref linkend="sql-rollback"/></member> |
| 93 |
<member><xref linkend="sql-savepoint"/></member> |
| 94 |
<member><xref linkend="sql-set-transaction"/></member> |
| 95 |
</simplelist> |
| 96 |
</refsect1> |
| 97 |
</refentry> |