Re: session_replication_role meaning? - Mailing list pgsql-general

From Laurenz Albe
Subject Re: session_replication_role meaning?
Date
Msg-id 1517301376.2517.14.camel@cybertec.at
Whole thread Raw
In response to session_replication_role meaning?  (Luca Ferrari <fluca1978@gmail.com>)
Responses Re: session_replication_role meaning?  (Jan Wieck <jan@wi3ck.info>)
List pgsql-general
Luca Ferrari wrote:
> 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'.

It is used to enable or disable triggers.

By default, tables are created with all triggers enabled, which means
that they fire with the default setting "session_replication_role = origin".

You can change "session_replication_role" to "replica" to disable the firing
of triggers (unless they are set ENABLE REPLICA or ENABLE ALWAYS).
This is done by the logical replication apply worker, but you can also
use it to bypass triggers, e.g. to speed up operation, if you know what
you are doing.

What is confusing is that there are three settings for "session_replication_role",
but the two settings "local" and "origin" have the same meaning.
Maybe that was meant to change at some point, but I see no explanation in
the original discussion.

Yours,
Laurenz Albe


pgsql-general by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: session_replication_role meaning?
Next
From: Robert Zenz
Date:
Subject: Re: Information on savepoint requirement within transctions