pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: session_replication_role meaning?
Date: Tue, 30 Jan 2018 10:30:53 +0200
Message-ID: <018ec6b6-35c9-b8eb-4fc2-cb13d691d154@matrix.gatewaynet.com> (raw)
In-Reply-To: <CAKoxK+7qePHxaFxY3FUxNiTL98tR-LShmPQOoryr7RrH=LFx6A@mail.gmail.com>
References: <CAKoxK+7qePHxaFxY3FUxNiTL98tR-LShmPQOoryr7RrH=LFx6A@mail.gmail.com>

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 might want 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 simply enabled 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 order not to send those back and cause an endless loop.
>
> Thanks,
> Luca
>

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





view thread (6+ messages)  latest in thread

Message-ID: <018ec6b6-35c9-b8eb-4fc2-cb13d691d154@matrix.gatewaynet.com>
Permalink:  ../018ec6b6-35c9-b8eb-4fc2-cb13d691d154@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/018ec6b6-35c9-b8eb-4fc2-cb13d691d154@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: achill@matrix.gatewaynet.com
  Subject: Re: session_replication_role meaning?
  In-Reply-To: <018ec6b6-35c9-b8eb-4fc2-cb13d691d154@matrix.gatewaynet.com>
  References: <CAKoxK+7qePHxaFxY3FUxNiTL98tR-LShmPQOoryr7RrH=LFx6A@mail.gmail.com> <018ec6b6-35c9-b8eb-4fc2-cb13d691d154@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox