@@ -456,14 +456,30 @@ ALTER TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceable>
456
456
requires superuser privileges; it should be done with caution since
457
457
of course the integrity of the constraint cannot be guaranteed if the
458
458
triggers are not executed.
459
+ </para>
460
+
461
+ <para>
459
462
The trigger firing mechanism is also affected by the configuration
460
463
variable <xref linkend="guc-session-replication-role"/>. Simply enabled
461
- triggers will fire when the replication role is <quote>origin</quote>
464
+ triggers (the default) will fire when the replication role is <quote>origin</quote>
462
465
(the default) or <quote>local</quote>. Triggers configured as <literal>ENABLE
463
466
REPLICA</literal> will only fire if the session is in <quote>replica</quote>
464
467
mode, and triggers configured as <literal>ENABLE ALWAYS</literal> will
465
- fire regardless of the current replication mode.
468
+ fire regardless of the current replication role.
469
+ </para>
470
+
471
+ <para>
472
+ The effect of this mechanism is that in the default configuration,
473
+ triggers do not fire on replicas. This is useful because if a trigger
474
+ is used on the origin to propagate data between tables, then the
475
+ replication system will also replicate the propagated data, and the
476
+ trigger should not fire a second time on the replica, because that would
477
+ lead to duplication. However, if a trigger is used for another purpose
478
+ such as creating external alerts, then it might be appropriate to set it
479
+ to <literal>ENABLE ALWAYS</literal> so that it is also fired on
480
+ replicas.
466
481
</para>
482
+
467
483
<para>
468
484
This command acquires a <literal>SHARE ROW EXCLUSIVE</literal> lock.
469
485
</para>
@@ -481,6 +497,12 @@ ALTER TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceable>
481
497
are always applied in order to keep views working even if the current
482
498
session is in a non-default replication role.
483
499
</para>
500
+
501
+ <para>
502
+ The rule firing mechanism is also affected by the configuration variable
503
+ <xref linkend="guc-session-replication-role"/>, analogous to triggers as
504
+ described above.
505
+ </para>
484
506
</listitem>
485
507
</varlistentry>
486
508
0 commit comments