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');