Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39aa78c

Browse files
author
Liudmila Mantrova
committed
Doc fix for autonomous transactions - PGPRO-511
1 parented95071 commit39aa78c

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

‎doc/src/sgml/atx.sgml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,102 @@
11
<!-- doc/src/sgml/atx.sgml -->
22

33
<chapter id="atx">
4-
<title>Autonomoustransactions</title>
4+
<title>AutonomousTransactions</title>
55

66
<sect1 id="atx-overview">
7-
<title>Overview of autonomous transactions</title>
7+
<title>Overview</title>
88

99
<para>
1010
&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 rollbackasubtransaction without affectingtheparent transaction. But commit of a subtraction is delayed until
1212
commit of parent transaction.
1313
</para>
1414
<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 &mdash; <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.
2317
</para>
2418

2519
</sect1>
2620

2721
<sect1><title>Behavior</title>
2822
<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 starta subtransaction. Then T0 is paused and pushed in an<acronym>AST</acronym> stack, and a new transaction (call it T1) is started.
23+
Anautonomous transaction can happen only inside another transaction.
24+
Inside an existing transaction (call it T0), the user can decide to startan autonomous transaction. Then T0 is paused and pushed in anautonomous transaction stack, and a new transaction (call it T1) is started.
3125
</para>
3226
<para>
33-
At some point in the future the user can commit thesubtransaction; 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 theautonomous transaction; after T1 is committed then T0 is popped from theautonomous 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 theautonomous transaction stack and then committed.
3529
</para>
3630
<para>
3731
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.
3832
All the possible combinations of <command>COMMIT</command> / <command>ROLLBACK</command> for T0 and T1 can happen;
3933
for instance, it is possible to COMMIT T1 and ROLLBACK T0.
40-
It is possible to nestsubtransactions, 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 nestautonomous transactions, up to a global resource limit (e.g. theautonomous transaction stack size) which can be set on the server.
4135
</para>
4236

4337
</sect1>
4438

45-
<sect1><title>Example</title>
39+
<sect1><title>Examples</title>
4640

4741
<para>
48-
The following figure describes anexample where atransactionexecutes 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 anautonomoustransactionis executed. A continuous line denotes an active transaction, while a dotted line denotes a transaction which has been paused and pushed in theautonomous transaction stack. Time flows downwards.
4943
</para>
5044

5145
<programlisting>
52-
BEGIN; --start ordinarytx T0
46+
BEGIN; --starts ordinarytransaction T0
5347
|
5448
INSERT INTO t VALUES (1);
5549
:\
56-
: BEGIN AUTONOMOUS TRANSACTION; -- start AST tx T1, pushes T0 into stack
50+
: BEGIN AUTONOMOUS TRANSACTION; -- starts autonomous transaction
51+
: | -- T1, pushes T0 into stack
5752
: |
5853
: INSERT INTO t VALUES (2);
5954
: |
60-
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION; -- ends tx T1, pops tx T0 from stack
55+
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION;
56+
: | -- ends autonomous transaction
57+
: | -- T1, pops transaction T0 from stack
6158
:/
62-
COMMIT / ROLLBACK; -- endstx T0
59+
COMMIT / ROLLBACK;-- endstransaction T0
6360
</programlisting>
6461

6562
<para>
66-
Depending on the two choices between <command>COMMIT</command> and <command>ROLLBACK</command> we can get4 different outputs from:
63+
Depending on the two choices between <command>COMMIT</command> and <command>ROLLBACK</command>, we can getfour different outputs from:
6764

6865
<programlisting>
6966
SELECT sum(x) from t;
7067
</programlisting>
7168
</para>
7269

73-
</sect1>
74-
<sect1><title>Example 2 (more than one subtransaction)</title>
75-
7670
<para>
77-
The parent transaction can have more than onesubtransaction, just by repeatingtheapplication of thepush/pop cycle.
71+
The parent transaction can have more than oneautonomous transaction ifthe push/pop cycle is repeated.
7872
</para>
7973

8074
<programlisting>
81-
BEGIN; --start ordinarytx T0
75+
BEGIN;--starts ordinarytransaction T0
8276
|
8377
INSERT INTO t VALUES (1);
8478
:\
85-
: BEGIN AUTONOMOUS TRANSACTION; -- start AST tx T1, pushes T0 into stack
79+
: BEGIN AUTONOMOUS TRANSACTION; -- starts autonomous transaction
80+
: | -- T1, pushes T0 into stack
8681
: |
8782
: INSERT INTO t VALUES (2);
8883
: |
89-
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION; -- ends tx T1, pops tx T0 from stack
84+
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION;
85+
: | -- ends autonomous transaction
86+
: | -- T1, pops T0 from stack
9087
:/
9188
|
9289
:\
93-
: BEGIN AUTONOMOUS TRANSACTION; -- start AST tx T2, pushes T0 into stack
90+
: BEGIN AUTONOMOUS TRANSACTION; -- starts autonomous transaction
91+
: | -- T2, pushes T0 into stack
9492
: |
9593
: INSERT INTO t VALUES (4);
9694
: |
97-
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION; -- ends tx T2, pops tx T0 from stack
95+
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION;
96+
: | -- ends autonomous transaction
97+
: | -- T2, pops T0 from stack
9898
:/
99-
COMMIT / ROLLBACK; -- endstx T0
99+
COMMIT / ROLLBACK;-- endstransaction T0
100100
</programlisting>
101101

102102
</sect1>
@@ -106,19 +106,19 @@ COMMIT / ROLLBACK; -- ends tx T0
106106
<para>
107107
Visibility rules work as in the case of independent transactions executed via <literal>dblink</literal>.
108108
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 autonomoussubtransaction.
110-
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomoussubtransaction.
109+
In case of Read Committed isolation level the parent transaction will see changes made by autonomoustransactions.
110+
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomoustransactions.
111111
</para>
112112

113113
<para>
114-
Now single-session deadlocks become possible, because an<acronym>AST</acronym>can become entangled with one of the paused transactions init's session.
114+
Now single-session deadlocks become possible, because anautonomous transactioncan become entangled with one of the paused transactions inits session.
115115
Autonomous transaction T1 is assumed to depend on parent transaction T0 and if it attempts to obtain any resource locked by T0, then
116116
deadlock is reported.
117117
</para>
118118

119119
</sect1>
120120

121-
<sect1><title>SQLgrammar extension forautonomous transactions</title>
121+
<sect1><title>SQLGrammar Extension forAutonomous Transactions</title>
122122

123123
<para>
124124
&productname; <literal>BEGIN</literal>/<literal>END</literal> transaction statements are extended by optional keyword <literal>AUTONOMOUS</literal>:
@@ -131,16 +131,16 @@ deadlock is reported.
131131

132132
<para>
133133
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 transactioncan not be autonomous.
134+
It is possible to have several nesting levels of autonomous transactions, but top level transactioncannot be autonomous.
135135
</para>
136136

137137
</sect1>
138138

139-
<sect1><title>PL/pgSQLgrammar extension forautonomous transactions</title>
139+
<sect1><title>PL/pgSQLGrammar Extension forAutonomous Transactions</title>
140140

141141
<para>
142142
Block construction in PL/pgSQL is extended by optional <literal>autonomous</literal> keyword.
143-
It is possible to treatallfunction body as autonomous transaction:
143+
It is possible to treatthe wholefunction body as an autonomous transaction:
144144
</para>
145145

146146
<programlisting>
@@ -178,11 +178,11 @@ When an error is caught by an <literal>EXCEPTION</literal> clause, the local var
178178

179179
</sect1>
180180

181-
<sect1><title>PL/Pythonextension forautonomous transactions</title>
181+
<sect1><title>PL/PythonExtension forAutonomous Transactions</title>
182182

183183
<para>
184184
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 startanautonomous transaction:
186186
</para>
187187

188188
<programlisting>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp