pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Avi Weinberg <AviW@gilat.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Are Foreign Key Disabled During Logical Replication Initial Sync?
Date: Wed, 8 Dec 2021 11:43:34 +0100
Message-ID: <37798fc0-d990-e531-f171-80e79f8f1c87@enterprisedb.com> (raw)
In-Reply-To: <DB9PR07MB7180EA671641A151268ADE51CB6E9@DB9PR07MB7180.eurprd07.prod.outlook.com>
References: <DB9PR07MB718088224479C92120503723CB6D9@DB9PR07MB7180.eurprd07.prod.outlook.com>
	<6a957e68-9490-2cf3-e390-88cd7545251c@enterprisedb.com>
	<DB9PR07MB7180EA671641A151268ADE51CB6E9@DB9PR07MB7180.eurprd07.prod.outlook.com>

On 07.12.21 08:51, Avi Weinberg wrote:
> Just to clarify, they are disabled during initial sync only or are always disabled on subscriber side?
> Are all triggers disabled during initial sync or just foreign keys?

All triggers are by default disabled on replicas.  See the ALTER TABLE 
clauses DISABLE/ENABLE [ REPLICA | ALWAYS ] TRIGGER to change this.

> How can I know that initial sync completed for all tables?  Is it checking when pg_subscription_rel.srsubstate is 'i' or 'd' for all tables or there is a better way?

There are various ways to phrase this.  The test suite often uses this 
query:

SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN 
('r', 's');





view thread (4+ messages)

Message-ID: <37798fc0-d990-e531-f171-80e79f8f1c87@enterprisedb.com>
Permalink:  ../37798fc0-d990-e531-f171-80e79f8f1c87@enterprisedb.com/
Also on:    postgresql.org/message-id/37798fc0-d990-e531-f171-80e79f8f1c87@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, AviW@gilat.com
  Subject: Re: Are Foreign Key Disabled During Logical Replication Initial Sync?
  In-Reply-To: <37798fc0-d990-e531-f171-80e79f8f1c87@enterprisedb.com>
  References: <DB9PR07MB718088224479C92120503723CB6D9@DB9PR07MB7180.eurprd07.prod.outlook.com> <6a957e68-9490-2cf3-e390-88cd7545251c@enterprisedb.com> <DB9PR07MB7180EA671641A151268ADE51CB6E9@DB9PR07MB7180.eurprd07.prod.outlook.com> <37798fc0-d990-e531-f171-80e79f8f1c87@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox