Skip to content

Commit 4210f28

Browse files
committed
updated to xaggr.sgml
1 parent 96f3253 commit 4210f28

File tree

5 files changed

+375
-88
lines changed

5 files changed

+375
-88
lines changed

postgresql/doc/src/sgml/test-decoding.sgml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ ____________________________________________________________________________-->
6565

6666
<programlisting>
6767
postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'include-xids', '0');
68-
location | xid | data
68+
lsn | xid | data
6969
-----------+-----+--------------------------------------------------
7070
0/16D30F8 | 691 | BEGIN
7171
0/16D32A0 | 691 | table public.data: INSERT: id[int4]:2 data[text]:'arg'
@@ -79,4 +79,48 @@ postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'i
7979
</programlisting>
8080
</para>
8181

82+
<!--==========================orignal english content==========================
83+
<para>
84+
We can also get the changes of the in-progress transaction, and the typical
85+
output might be:
86+
87+
<programlisting>
88+
postgres[33712]=#* SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'stream-changes', '1');
89+
lsn | xid | data
90+
-&minus;-&minus;-&minus;-&minus;-&minus;-+-&minus;-&minus;-+-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;-&minus;
91+
0/16B21F8 | 503 | opening a streamed block for transaction TXN 503
92+
0/16B21F8 | 503 | streaming change for TXN 503
93+
0/16B2300 | 503 | streaming change for TXN 503
94+
0/16B2408 | 503 | streaming change for TXN 503
95+
0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503
96+
0/16B21F8 | 503 | opening a streamed block for transaction TXN 503
97+
0/16BECA8 | 503 | streaming change for TXN 503
98+
0/16BEDB0 | 503 | streaming change for TXN 503
99+
0/16BEEB8 | 503 | streaming change for TXN 503
100+
0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503
101+
(10 rows)
102+
</programlisting>
103+
</para>
104+
____________________________________________________________________________-->
105+
<para>
106+
我们也能获得正在进行事务的改变,典型输出可能是:
107+
108+
<programlisting>
109+
postgres[33712]=#* SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'stream-changes', '1');
110+
lsn | xid | data
111+
-----------+-----+--------------------------------------------------
112+
0/16B21F8 | 503 | opening a streamed block for transaction TXN 503
113+
0/16B21F8 | 503 | streaming change for TXN 503
114+
0/16B2300 | 503 | streaming change for TXN 503
115+
0/16B2408 | 503 | streaming change for TXN 503
116+
0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503
117+
0/16B21F8 | 503 | opening a streamed block for transaction TXN 503
118+
0/16BECA8 | 503 | streaming change for TXN 503
119+
0/16BEDB0 | 503 | streaming change for TXN 503
120+
0/16BEEB8 | 503 | streaming change for TXN 503
121+
0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503
122+
(10 rows)
123+
</programlisting>
124+
</para>
125+
82126
</sect1>

postgresql/doc/src/sgml/trigger.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,21 @@ ____________________________________________________________________________-->
191191
触发器也可以根据它们是否在操作<firstterm>之前</firstterm>、<firstterm>之后</firstterm>触发,或者被触发来<firstterm>取代</firstterm>操作来分类。它们分别指<literal>BEFORE</literal>触发器、<literal>AFTER</literal> 触发器以及<literal>INSTEAD OF</literal>触发器。语句级<literal>BEFORE</literal>触发器在语句开始做任何事情之前被触发,而语句级<literal>AFTER</literal>触发器则在语句做完所有事情之后被触发。这些触发器类型可以被定义在表、视图或外部表上。行级<literal>BEFORE</literal>触发器在每一个行被操作之前被触发,而行级<literal>AFTER</literal>触发器在语句结束之后被触发(但在任何语句级<literal>AFTER</literal>触发器之前)。这些触发器类型只能被定义在表和外部表上,但不能定义在视图上。<literal>INSTEAD OF</literal>触发器只能被定义在视图上,并且只能定义在行级,当视图中的每一行被标识为需要被操作时,它们会立即触发。
192192
</para>
193193

194+
<!--==========================orignal english content==========================
195+
<para>
196+
The execution of an <literal>AFTER</literal> trigger can be deferred
197+
to the end of the transaction, rather than the end of the statement,
198+
if it was defined as a <firstterm>constraint trigger</firstterm>.
199+
In all cases, a trigger is executed as part of the same transaction as
200+
the statement that triggered it, so if either the statement or the
201+
trigger causes an error, the effects of both will be rolled back.
202+
</para>
203+
____________________________________________________________________________-->
204+
<para>
205+
一个<literal>AFTER</literal>触发器的执行可以推迟到事务的最后,而不是语句的最后,如果它被定义为<firstterm>constraint trigger</firstterm>。
206+
在所有情况下,触发器作为触发它的语句的同一个事务的一部分来执行,所以无论语句或触发器导致错误,两者的后果都将会回滚。
207+
</para>
208+
194209
<!--==========================orignal english content==========================
195210
<para>
196211
A statement that targets a parent table in an inheritance or partitioning
@@ -598,7 +613,7 @@ ____________________________________________________________________________-->
598613
trigger <emphasis>will</emphasis> see the effects of data
599614
changes for rows previously processed in the same outer
600615
command. This requires caution, since the ordering of these
601-
change events is not in general predictable; a SQL command that
616+
change events is not in general predictable; an SQL command that
602617
affects multiple rows can visit the rows in any order.
603618
</para>
604619
</listitem>

0 commit comments

Comments
 (0)