Re: BUG #18019: misbehaviour by replication - Mailing list pgsql-bugs

From Kyotaro Horiguchi
Subject Re: BUG #18019: misbehaviour by replication
Date
Msg-id 20230713.164901.624326636983516094.horikyota.ntt@gmail.com
Whole thread Raw
In response to BUG #18019: misbehaviour by replication  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #18019: misbehaviour by replication  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-bugs
At Wed, 12 Jul 2023 10:08:54 +0000, PG Bug reporting form <noreply@postgresql.org> wrote in 
(In short, foreign constraint trigger doesn't fire on apply woker.)
> this is (imho) misbehaviour! 
> replication should not break integrity and break references logic!
> or explain why it's right and how to live with it?

You can activate the fkey constraints on the subscriber by setting the
underlying triggers to ENABLE ALWAYS (or REPLICA) using the ALTER
TABLE command.

By design, triggers are not active on subscribers by default. It might
seem peculiar, especially in the context of foreign key constraints,
as check constraints are operational on subscribers. Moreover,
although the documentation mentions that the purpose of the behavior
is avoid propagating data between tables again on subscribers, foreign
key triggers don't contribute to this.

If we're willing to enable constraint triggers on subscribers by
default, CreateTrigger can choose trigger_fires_when passed to
CreateTriggerFiringOn based on constraintOid.  However, I'm unceratin
about the case of CREATE CONSTRAINT TRIGGER.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: The same 2PC data maybe recovered twice
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: BUG #18019: misbehaviour by replication