1- <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.9 2002/08/04 04:31:44 momjian Exp $ -->
1+ <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.10 2003/01/10 22:03:27 petere Exp $ -->
22<refentry id="SQL-SET-TRANSACTION">
33 <docinfo>
44 <date>2000-11-24</date>
1616
1717 <refsynopsisdiv>
1818 <synopsis>
19- SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
20- SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL
21- { READ COMMITTED | SERIALIZABLE }
19+ SET TRANSACTION
20+ [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]
21+ SET SESSION CHARACTERISTICS AS TRANSACTION
22+ [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]
2223 </synopsis>
2324 </refsynopsisdiv>
2425
2526 <refsect1>
2627 <title>Description</title>
2728
2829 <para>
29- This command sets the transaction isolation level. The
30- <command>SET TRANSACTION</command> command sets the characteristics
31- for the current SQL-transaction. It has no effect on any subsequent
32- transactions. This command cannot be used after the first query or data-modification
33- statement (<command>SELECT</command>, <command>INSERT</command>,
34- <command>DELETE</command>, <command>UPDATE</command>,
35- <command>FETCH</command>, <command>COPY</command>) of a transaction
36- has been executed. <command>SET SESSION CHARACTERISTICS</command>
37- sets the default transaction isolation level for each transaction
38- for a session. <command>SET TRANSACTION</command> can override it
39- for an individual transaction.
30+ The <command>SET TRANSACTION</command> command sets the transaction
31+ characteristics of the current SQL-transaction. It has no effect on
32+ any subsequent transactions. <command>SET SESSION
33+ CHARACTERISTICS</command> sets the default transaction
34+ characteristics for each transaction of a session. <command>SET
35+ TRANSACTION</command> can override it for an individual
36+ transaction.
37+ </para>
38+
39+ <para>
40+ The available transaction characteristics are the transaction
41+ isolation level and the transaction access mode (read/write or
42+ read-only).
4043 </para>
4144
4245 <para>
@@ -45,7 +48,7 @@ SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL
4548
4649 <variablelist>
4750 <varlistentry>
48- <term>READ COMMITTED</term>
51+ <term><literal> READ COMMITTED<literal> </term>
4952 <listitem>
5053 <para>
5154 A statement can only see rows committed before it began. This
@@ -55,7 +58,7 @@ SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL
5558 </varlistentry>
5659
5760 <varlistentry>
58- <term>SERIALIZABLE</term>
61+ <term><literal> SERIALIZABLE</literal> </term>
5962 <listitem>
6063 <para>
6164 The current transaction can only see rows committed before
@@ -72,6 +75,28 @@ SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL
7275 </listitem>
7376 </varlistentry>
7477 </variablelist>
78+
79+ The transaction isolation level cannot be set after the first query
80+ or data-modification statement (<command>SELECT</command>,
81+ <command>INSERT</command>, <command>DELETE</command>,
82+ <command>UPDATE</command>, <command>FETCH</command>,
83+ <command>COPY</command>) of a transaction has been executed.
84+ </para>
85+
86+ <para>
87+ The transaction access mode determines whether the transaction is
88+ read/write or read-only. Read/write is the default. When a
89+ transaction is read-only, the following SQL commands are
90+ disallowed: <literal>INSERT</literal>, <literal>UPDATE</literal>,
91+ <literal>DELETE</literal>, and <literal>COPY TO</literal> if the
92+ table they would write to is not a temporary table; all
93+ <literal>CREATE</literal>, <literal>ALTER</literal>, and
94+ <literal>DROP</literal> commands; <literal>COMMENT</literal>,
95+ <literal>GRANT</literal>, <literal>REVOKE</literal>,
96+ <literal>TRUNCATE</literal>; and <literal>EXPLAIN ANALYZE</literal>
97+ and <literal>EXECUTE</literal> if the command they would execute is
98+ among those listed. This is a high-level notion of read-only that
99+ does not prevent writes to disk.
75100 </para>
76101 </refsect1>
77102
@@ -97,7 +122,7 @@ SET default_transaction_isolation = '<replaceable>value</replaceable>'
97122 <title>SQL92, SQL99</title>
98123
99124 <para>
100- <option>SERIALIZABLE</option> is the default level in
125+ <option>SERIALIZABLE</option> is the defaulttransaction isolation level in
101126 <acronym>SQL</acronym>. <productname>PostgreSQL</productname> does
102127 not provide the isolation levels <option>READ UNCOMMITTED</option>
103128 and <option>REPEATABLE READ</option>. Because of multiversion
@@ -107,11 +132,10 @@ SET default_transaction_isolation = '<replaceable>value</replaceable>'
107132 </para>
108133
109134 <para>
110- In <acronym>SQL</acronym> there are two other transaction
111- characteristics that can be set with these commands: whether the
112- transaction is read-only and the size of the diagnostics area.
113- Neither of these concepts are supported in
114- <productname>PostgreSQL</productname>.
135+ In <acronym>SQL</acronym> there is one other transaction
136+ characteristic that can be set with these commands: the size of
137+ the diagnostics area. This concept is not supported in
138+ <productname>PostgreSQL</productname>.
115139 </para>
116140 </refsect2>
117141 </refsect1>