Re: Do we want to enable foreign key constraints on subscriber?

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Do we want to enable foreign key constraints on subscriber?
Date: 2023-07-20 05:17:12
Message-ID: CAA4eK1+Ckw3gaEPuZa+mCwNBV1wK6LMFSQYjdVOPcuT=S1-QJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 19, 2023 at 12:21 PM Kyotaro Horiguchi
<horikyota(dot)ntt(at)gmail(dot)com> wrote:
>
> There's an issue brought up in the -bugs list [1]. Since triggers are
> deactivated on a subscriber by default, foreign key constraints don't
> fire for replicated changes. The docs state this is done to prevent
> repetitive data propagation between tables on subscribers. But foreign
> key triggers don't contribute to this issue.
>

Right and recent reports indicate that this does cause inconvenience for users.

> My understanding is that constraint triggers, including ones created
> using the "CREATE CONSTRAINT TRIGGER" command, aren't spposed to alter
> data.
>

I also think so. You need to update the docs for this.

Peter E., do you remember if there is any specific problem in enabling
such triggers by default for apply side? The only thing that I can
think of is that the current behavior keeps the trigger-firing rules
the same for all kinds of triggers which has merits but OTOH it causes
inconvenience to users, especially for foreign-key checks.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-07-20 05:18:05 Re: Report distinct wait events when waiting for WAL "operation"
Previous Message Tatsuo Ishii 2023-07-20 05:15:13 Re: Row pattern recognition