Re: Are Foreign Key Disabled During Logical Replication Initial Sync? - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Are Foreign Key Disabled During Logical Replication Initial Sync?
Date
Msg-id 37798fc0-d990-e531-f171-80e79f8f1c87@enterprisedb.com
Whole thread Raw
In response to RE: Are Foreign Key Disabled During Logical Replication Initial Sync?  (Avi Weinberg <AviW@gilat.com>)
List pgsql-general
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');



pgsql-general by date:

Previous
From: Vikas Sharma
Date:
Subject: Re: how to get value of parameter set in session for other user
Next
From: Peter Eisentraut
Date:
Subject: Re: error connecting to pgbouncer admin console