You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/src/sgml/atx.sgml
+42-42Lines changed: 42 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -1,102 +1,102 @@
1
1
<!-- doc/src/sgml/atx.sgml -->
2
2
3
3
<chapter id="atx">
4
-
<title>Autonomous transactions</title>
4
+
<title>Autonomous Transactions</title>
5
5
6
6
<sect1 id="atx-overview">
7
-
<title>Overview of autonomous transactions</title>
7
+
<title>Overview</title>
8
8
9
9
<para>
10
10
&productname; supports nested transactions: they are rarely explicitly used by programmer and mostly used for error handling and stored
11
-
procedures. It is possible to rollback subtransaction without affecting parent transaction. But commit of subtraction is delayed until
11
+
procedures. It is possible to rollback a subtransaction without affecting the parent transaction. But commit of a subtraction is delayed until
12
12
commit of parent transaction.
13
13
</para>
14
14
<para>
15
-
But in some cases application needs to run several independent transactions in one session.
16
-
<quote>Autonomous Subtransactions</quote> (in short <acronym>AST</acronym>) denotes the capability of a single session
17
-
to run multiple independent transactions, as if multiple different sessions were executing each transaction.
18
-
</para>
19
-
<para>
20
-
Autonomous transactions are needed mostly for implementing audits, when the fact of performing audit should be reported regardless
21
-
status of audit itself: whether it was successfully completed or not.
22
-
Autonomous transactions are widely used in Oracle PL-SQL, so porting such procedures to &productname; is problematic without autonomous transaction support.
15
+
However, in some cases applications need to run several independent transactions inside a single transaction — <quote>autonomous transactions</quote>. Autonomous transactions are needed mostly for implementing audits, when the fact of performing an audit should be reported regardless of the
16
+
status of the audit itself: whether it was successfully completed or not.
23
17
</para>
24
18
25
19
</sect1>
26
20
27
21
<sect1><title>Behavior</title>
28
22
<para>
29
-
An <acronym>AST</acronym> can happen only inside another transaction.
30
-
Inside an existing transaction (call it T0), the user can decide to start a subtransaction. Then T0 is paused and pushed in an <acronym>AST</acronym> stack, and a new transaction (call it T1) is started.
23
+
An autonomous transaction can happen only inside another transaction.
24
+
Inside an existing transaction (call it T0), the user can decide to start an autonomous transaction. Then T0 is paused and pushed in an autonomous transaction stack, and a new transaction (call it T1) is started.
31
25
</para>
32
26
<para>
33
-
At some point in the future the user can commit the subtransaction; after T1 is committed then T0 is popped from the <acronym>AST</acronym> stack and resumed.
34
-
The user can also decide to <command>COMMIT</command> the parent transaction T0, in which case T1 is committed, then T0 is popped from the <acronym>AST</acronym> stack and then committed.
27
+
At some point in the future the user can commit the autonomous transaction; after T1 is committed then T0 is popped from the autonomous transaction stack and resumed.
28
+
The user can also decide to <command>COMMIT</command> the parent transaction T0, in which case T1 is committed, then T0 is popped from the autonomous transaction stack and then committed.
35
29
</para>
36
30
<para>
37
31
All the transactions happen synchronously; at any time only one transaction can be active, while in the stack there are zero (or more) paused transactions in the stack.
38
32
All the possible combinations of <command>COMMIT</command> / <command>ROLLBACK</command> for T0 and T1 can happen;
39
33
for instance, it is possible to COMMIT T1 and ROLLBACK T0.
40
-
It is possible to nest subtransactions, up to a global resource limit (e.g. the <acronym>AST</acronym> stack size) which can be set on the server.
34
+
It is possible to nest autonomous transactions, up to a global resource limit (e.g. the autonomous transaction stack size) which can be set on the server.
41
35
</para>
42
36
43
37
</sect1>
44
38
45
-
<sect1><title>Example</title>
39
+
<sect1><title>Examples</title>
46
40
47
41
<para>
48
-
The following figure describes an example where a transaction executes a subtransaction. A continuous line denotes an active transaction, while a dotted line denotes a transaction which has been paused and pushed in the <acronym>AST</acronym> stack. Time flows downwards.
42
+
This example illustrates how an autonomous transaction is executed. A continuous line denotes an active transaction, while a dotted line denotes a transaction which has been paused and pushed in the autonomous transaction stack. Time flows downwards.
49
43
</para>
50
44
51
45
<programlisting>
52
-
BEGIN; -- start ordinary tx T0
46
+
BEGIN; -- starts ordinary transaction T0
53
47
|
54
48
INSERT INTO t VALUES (1);
55
49
:\
56
-
: BEGIN AUTONOMOUS TRANSACTION; -- start AST tx T1, pushes T0 into stack
50
+
: BEGIN AUTONOMOUS TRANSACTION; -- starts autonomous transaction
Visibility rules work as in the case of independent transactions executed via <literal>dblink</literal>.
108
108
T1 does not see the effects of T0, because the latter has not been committed yet. T0 might see the effects of T1, depending on its own transaction isolation mode.
109
-
In case of Read Committed isolation level the parent transaction will see changes made by autonomous subtransaction.
110
-
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomous subtransaction.
109
+
In case of Read Committed isolation level the parent transaction will see changes made by autonomous transactions.
110
+
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomous transactions.
111
111
</para>
112
112
113
113
<para>
114
-
Now single-session deadlocks become possible, because an <acronym>AST</acronym> can become entangled with one of the paused transactions in it's session.
114
+
Now single-session deadlocks become possible, because an autonomous transaction can become entangled with one of the paused transactions in its session.
115
115
Autonomous transaction T1 is assumed to depend on parent transaction T0 and if it attempts to obtain any resource locked by T0, then
116
116
deadlock is reported.
117
117
</para>
118
118
119
119
</sect1>
120
120
121
-
<sect1><title>SQL grammar extension for autonomous transactions</title>
121
+
<sect1><title>SQL Grammar Extension for Autonomous Transactions</title>
122
122
123
123
<para>
124
124
&productname; <literal>BEGIN</literal>/<literal>END</literal> transaction statements are extended by optional keyword <literal>AUTONOMOUS</literal>:
@@ -131,16 +131,16 @@ deadlock is reported.
131
131
132
132
<para>
133
133
Specifying <literal>AUTONOMOUS</literal> keyword in <literal>END TRANSACTION</literal> clause is optional.
134
-
It is possible to have several nesting levels of autonomous transactions, but top level transaction can not be autonomous.
134
+
It is possible to have several nesting levels of autonomous transactions, but top level transaction cannot be autonomous.
135
135
</para>
136
136
137
137
</sect1>
138
138
139
-
<sect1><title>PL/pgSQL grammar extension for autonomous transactions</title>
139
+
<sect1><title>PL/pgSQL Grammar Extension for Autonomous Transactions</title>
140
140
141
141
<para>
142
142
Block construction in PL/pgSQL is extended by optional <literal>autonomous</literal> keyword.
143
-
It is possible to treat all function body as autonomous transaction:
143
+
It is possible to treat the whole function body as an autonomous transaction:
144
144
</para>
145
145
146
146
<programlisting>
@@ -178,11 +178,11 @@ When an error is caught by an <literal>EXCEPTION</literal> clause, the local var
178
178
179
179
</sect1>
180
180
181
-
<sect1><title>PL/Python extension for autonomous transactions</title>
181
+
<sect1><title>PL/Python Extension for Autonomous Transactions</title>
182
182
183
183
<para>
184
184
In addition to <varname>subtransaction</varname> method, PL/Python module provides new <varname>autonomous</varname> method
185
-
which can be used in <varname>WITH</varname> clause to start autonomous transaction:
185
+
which can be used in <varname>WITH</varname> clause to start an autonomous transaction:
0 commit comments