Re: [HACKERS] Triggers and logical replication (10devel) - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: [HACKERS] Triggers and logical replication (10devel)
Date
Msg-id CAHyXU0zpyLp2ySnPi4YreDbzKavcV89PC9rLwg5KNX=P1PW5Ew@mail.gmail.com
Whole thread Raw
In response to [HACKERS] Triggers and logical replication (10devel)  (Egor Rogov <e.rogov@postgrespro.ru>)
Responses Re: [HACKERS] Triggers and logical replication (10devel)  (Egor Rogov <e.rogov@postgrespro.ru>)
List pgsql-hackers
On Fri, Apr 21, 2017 at 5:08 AM, Egor Rogov <e.rogov@postgrespro.ru> wrote:
> Hello,
> It seams that tiggers don't fire on subscriber's tables during logical
> replication. Is it a bug?

Reading the documentation (which is TBH a bit hard to follow) it
appears that it is expected behavior.

https://www.postgresql.org/docs/devel/static/logical-replication-architecture.html#logical-replication-snapshot
states:

"The apply process on the subscriber database always runs with
session_replication_role set to replica, which produces the usual
effects on triggers and constraints."

https://www.postgresql.org/docs/devel/static/sql-altertable.html states:

"The trigger firing mechanism is also affected by the configuration
variable session_replication_role. Simply enabled triggers will fire
when the replication role is “origin” (the default) or “local”."

merlin



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] On-disk format of SCRAM verifiers
Next
From: Simon Riggs
Date:
Subject: Re: [HACKERS] On-disk format of SCRAM verifiers