pgq.sqltriga/pgq.logutriga now fire in origin and replica roles.
authorMartin Pihlak <martin.pihlak@gmail.com>
Fri, 27 Nov 2009 09:34:23 +0000 (11:34 +0200)
committerMartin Pihlak <martin.pihlak@gmail.com>
Fri, 27 Nov 2009 09:34:23 +0000 (11:34 +0200)
This allows 'ENABLE ALWAYS' and 'ENABLE REPLICA' triggers to
fire on the target side. Previous behaviour was to only fire in
origin role.

sql/pgq/triggers/common.c

index 20e47395cd8c387204fe80dc08e82dd797ee054d..fc3c3b323490ff15b2228d1fb89abf6b5e45e081 100644 (file)
@@ -528,7 +528,11 @@ bool pgqtriga_is_pkey(PgqTriggerEvent *ev, TriggerData *tg, int i, int attkind_i
 bool pgq_is_logging_disabled(void)
 {
 #if defined(PG_VERSION_NUM) && PG_VERSION_NUM >= 80300
-       if (SessionReplicationRole != SESSION_REPLICATION_ROLE_ORIGIN)
+       /*
+        * Force-disable the trigger in local replication role. In other
+        * roles rely on the enabled/disabled status of the trigger.
+        */
+       if (SessionReplicationRole == SESSION_REPLICATION_ROLE_LOCAL)
                return true;
 #endif
        return false;