A while ago I created this table to easily understand which kind of trigger
gets executed under what setting of session_replication_role. There's
already a description in the docs which describes it:

<quote>
Simply enabled triggers will fire when the replication role is
"origin"(the default) or
"local". Triggers configured as ENABLE REPLICA will only fire if the
session is in "replica" mode, and triggers configured as ENABLE ALWAYS will
fire regardless of the current replication mode.
</quote>

I was wondering if this table would add value for anyone looking at those
statements and trying to develop a similar table in their heads.

                         +--------------------------+
                         | session_replication_role |
+------------------------+--------+---------+-------+
| ALTER TABLE Command    | origin | replica | local |
+------------------------+--------+---------+-------+
| ENABLE         TRIGGER |   x    |         |   x   |
| ENABLE REPLICA TRIGGER |        |    x    |       |
| ENABLE ALWAYS  TRIGGER |   x    |    x    |   x   |
+------------------------+--------+---------+-------+

Regards,
-- 
Gurjeet Singh
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Reply via email to