Re: BUG #18019: misbehaviour by replication

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: a(dot)kutepow(at)prodat-sql(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18019: misbehaviour by replication
Date: 2023-07-13 10:30:40
Message-ID: CAA4eK1JLMEvELR9FLRFTxBfQVzTwCttRXZJroq7Unufa-Grw-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Jul 13, 2023 at 1:19 PM Kyotaro Horiguchi
<horikyota(dot)ntt(at)gmail(dot)com> wrote:
>
> At Wed, 12 Jul 2023 10:08:54 +0000, PG Bug reporting form <noreply(at)postgresql(dot)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.
>

It might be a good idea to discuss this topic on -hackers as this is
the way it works from the beginning. So changing it requires broader
discussion.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Manika Singhal 2023-07-13 13:04:48 Re: BUG #17968: installation
Previous Message Amit Kapila 2023-07-13 10:28:49 Re: BUG #18019: misbehaviour by replication