Re: Do we want to enable foreign key constraints on subscriber? - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Do we want to enable foreign key constraints on subscriber?
Date
Msg-id CAA4eK1+Ckw3gaEPuZa+mCwNBV1wK6LMFSQYjdVOPcuT=S1-QJA@mail.gmail.com
Whole thread Raw
In response to Do we want to enable foreign key constraints on subscriber?  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
On Wed, Jul 19, 2023 at 12:21 PM Kyotaro Horiguchi
<horikyota.ntt@gmail.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.



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Row pattern recognition
Next
From: Michael Paquier
Date:
Subject: Re: Report distinct wait events when waiting for WAL "operation"