Re: session_replication_role meaning? - Mailing list pgsql-general

From Achilleas Mantzios
Subject Re: session_replication_role meaning?
Date
Msg-id 018ec6b6-35c9-b8eb-4fc2-cb13d691d154@matrix.gatewaynet.com
Whole thread Raw
In response to session_replication_role meaning?  (Luca Ferrari <fluca1978@gmail.com>)
List pgsql-general
On 30/01/2018 09:48, Luca Ferrari wrote:
> Hi all,
> now this should be trivial, but I cannot udnerstand what is the
> purpose of session_replication_role
> <https://www.postgresql.org/docs/10/static/runtime-config-client.html#GUC-SESSION-REPLICATION-ROLE>
> or better, when I should use it in a way different from 'origin'.
> I've a logical replication setup and both master and client
> connections default to 'origin', so it has to be specified manually.
> What is its meaning?

This has an effect on dictating how triggers are fired.
For instance if you have built your proprietary replication mechanism based on triggers (e.g. Slony, DBmirror) then you
mightwant at certain occasions (e.g. reading xactions from a master) to avoid 
 
firing triggers in order e.g. to prevent bounce back messages to the originator. If your replication trigger is a
simplyenabled trigger, then by setting session_replication_role to replica will 
 
prevent the trigger from firing. This could be useful in the code where you execute SQL originating from the master, in
ordernot to send those back and cause an endless loop.
 
>
> Thanks,
> Luca
>

-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt



pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Information on savepoint requirement within transctions
Next
From: Laurenz Albe
Date:
Subject: Re: session_replication_role meaning?