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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 9 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy