Skip to content

Commit 469150a

Browse files
committed
Doc: clarify how triggers relate to transactions.
Laurenz Albe, per gripe from Nathan Long. Discussion: https://postgr.es/m/161953360822.695.15805897835151971142@wrigleys.postgresql.org
1 parent 2dc53fe commit 469150a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

doc/src/sgml/ref/create_trigger.sgml

+4
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ CREATE [ OR REPLACE ] [ CONSTRAINT ] TRIGGER <replaceable class="parameter">name
175175
</para>
176176

177177
<para>
178+
<indexterm>
179+
<primary>trigger</primary>
180+
<secondary>constraint trigger</secondary>
181+
</indexterm>
178182
When the <literal>CONSTRAINT</literal> option is specified, this command creates a
179183
<firstterm>constraint trigger</firstterm>. This is the same as a regular trigger
180184
except that the timing of the trigger firing can be adjusted using

doc/src/sgml/trigger.sgml

+9
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@
122122
row in the view is identified as needing to be operated on.
123123
</para>
124124

125+
<para>
126+
The execution of an <literal>AFTER</literal> trigger can be deferred
127+
to the end of the transaction, rather than the end of the statement,
128+
if it was defined as a <firstterm>constraint trigger</firstterm>.
129+
In all cases, a trigger is executed as part of the same transaction as
130+
the statement that triggered it, so if either the statement or the
131+
trigger causes an error, the effects of both will be rolled back.
132+
</para>
133+
125134
<para>
126135
A statement that targets a parent table in an inheritance or partitioning
127136
hierarchy does not cause the statement-level triggers of affected child

0 commit comments

Comments
 (0)