summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2021-09-01 21:24:59 +0000
committerTom Lane2021-09-01 21:24:59 +0000
commit469150a240dd79acbe7d86cb5df869d95f4d6d2d (patch)
tree98916d44c48480ab727ec21bdf81244e5d3935f4
parent2dc53fe2a77d8d5f22c656fdf6590198e358a996 (diff)
Doc: clarify how triggers relate to transactions.
Laurenz Albe, per gripe from Nathan Long. Discussion: https://postgr.es/m/[email protected]
-rw-r--r--doc/src/sgml/ref/create_trigger.sgml4
-rw-r--r--doc/src/sgml/trigger.sgml9
2 files changed, 13 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml
index 3f4b5acc7b7..e4afa1c01d3 100644
--- a/doc/src/sgml/ref/create_trigger.sgml
+++ b/doc/src/sgml/ref/create_trigger.sgml
@@ -175,6 +175,10 @@ CREATE [ OR REPLACE ] [ CONSTRAINT ] TRIGGER <replaceable class="parameter">name
</para>
<para>
+ <indexterm>
+ <primary>trigger</primary>
+ <secondary>constraint trigger</secondary>
+ </indexterm>
When the <literal>CONSTRAINT</literal> option is specified, this command creates a
<firstterm>constraint trigger</firstterm>. This is the same as a regular trigger
except that the timing of the trigger firing can be adjusted using
diff --git a/doc/src/sgml/trigger.sgml b/doc/src/sgml/trigger.sgml
index f1a845f7568..7e2654493bb 100644
--- a/doc/src/sgml/trigger.sgml
+++ b/doc/src/sgml/trigger.sgml
@@ -123,6 +123,15 @@
</para>
<para>
+ The execution of an <literal>AFTER</literal> trigger can be deferred
+ to the end of the transaction, rather than the end of the statement,
+ if it was defined as a <firstterm>constraint trigger</firstterm>.
+ In all cases, a trigger is executed as part of the same transaction as
+ the statement that triggered it, so if either the statement or the
+ trigger causes an error, the effects of both will be rolled back.
+ </para>
+
+ <para>
A statement that targets a parent table in an inheritance or partitioning
hierarchy does not cause the statement-level triggers of affected child
tables to be fired; only the parent table's statement-level triggers are