Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egRJn-00048C-5D for pgsql-general@arkaria.postgresql.org; Tue, 30 Jan 2018 08:31:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egRJm-0004iG-1x for pgsql-general@arkaria.postgresql.org; Tue, 30 Jan 2018 08:31:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1egRJl-0004i6-QU for pgsql-general@lists.postgresql.org; Tue, 30 Jan 2018 08:31:01 +0000 Received: from host3.dynacom.ondsl.gr ([62.103.35.211] helo=smadev.internal.net) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egRJh-00036o-1O for pgsql-general@lists.postgresql.org; Tue, 30 Jan 2018 08:31:01 +0000 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id w0U8UrwJ074551 for ; Tue, 30 Jan 2018 10:30:54 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: session_replication_role meaning? To: pgsql-general@lists.postgresql.org References: From: Achilleas Mantzios Message-ID: <018ec6b6-35c9-b8eb-4fc2-cb13d691d154@matrix.gatewaynet.com> Date: Tue, 30 Jan 2018 10:30:53 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 > > 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