Обсуждение: Logical Replication postgres 10.5
Hello, Is Logical Replication ignore foreign key constraint ? How does it possible ? Thank you
On Tue, 2019-05-28 at 07:21 +0200, Mai Peng wrote: > Is Logical Replication ignore foreign key constraint ? How does it possible ? Can you specify what you mean by "ignoring foreign key constraints"? Like, some SQL that demonstrates what you are talking about. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com
On 28/5/19 8:21 π.μ., Mai Peng wrote:
The apply process on the subscriber runs withHello, Is Logical Replication ignore foreign key constraint ? How does it possible ?
session_replication_role
set to replica, this limits trigger firing, excluding normal triggers . FK constraints in pgsql are implemented with triggers, hence the behavior you are observing.
Thank you
-- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt
Please always include the mailing list in your replies. Mai Peng wrote: > Le 28 mai 2019 à 07:59, Laurenz Albe <laurenz.albe@cybertec.at> a écrit: > > > On Tue, 2019-05-28 at 07:21 +0200, Mai Peng wrote: > > > Is Logical Replication ignore foreign key constraint ? How does it possible ? > > > > Can you specify what you mean by "ignoring foreign key constraints"? > > Like, some SQL that demonstrates what you are talking about. > > The table that stores primary keys is empty, and the table with foreign keys still replicates. That is because "session_replication_role" is set to "replica" when changes are replicated. This prevents foreign key constraints from being checked. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com