2ndQuadrant / pglogical

Logical Replication extension for PostgreSQL 15, 14, 13, 12, 11, 10, 9.6, 9.5, 9.4 (Postgres), providing much faster replication than Slony, Bucardo or Londiste, as well as cross-version upgrades.

Home Page:http://2ndquadrant.com/en/resources/pglogical/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update `forward_origins` for the existing subscription

shreyasp opened this issue · comments

I have created a subscription to synchronise the data between a virtual machine and a GCP CloudSQL instance. Before we promote the CloudSQL instance to handle all the traffic, we want to establish bi-directional replication so the existing virtual machine instance can stay as a redundant backup or failover instance.

To set up the bi-directional replication, we need to set forward_origins to {} instead of the default {all}. I checked the existing documentation and found no method to update forward_origins for an existing subscription.

I would be thankful if you could point me out a workaround or method that can update the value for forward_origins in the case of an existing subscription.

Thanks,
Shreyas.

I had the same issue. I solved it by disabling the subscription and updating the subscription table directly.

select * from pglogical.alter_subscription_disable('sub1, true);
update pglogical.subscription set sub_forward_origins = '{}' where sub_name = 'sub1';

I don't know how pglogical works under the hood, so I don't know if doing this is recommended in production.