1

I have a table in two databases called test. I was able to make a row in the source database and have it replicated in the target database. But then I deleted the row in the target database. How do I get the row back? What if it's a million rows in each table and I want to synchronize between the two tables because for whatever reason there are repeat in the target database etc.

Here's what I did

create role sub247 with login password 'fakepassword' 
     replication;

SELECT * FROM pg_stat_replication;

alter user sub247 login connection limit 18;

GRANT SELECT ON ALL TABLES IN SCHEMA public TO sub247;

CREATE TABLE public.test ( test text COLLATE pg_catalog."default", test2 bigint ) WITH ( OIDS = FALSE ) TABLESPACE pg_default;

ALTER TABLE public.test OWNER to postgres; insert into test (test,test2) values ('a',1)

alter table test replica identity full; create publication pub247b for table test;

and then on the target database

create subscription sub247b connection 'host=facebook.com dbname=247 user=sub247 password=fakepassword port=5432' publication pub247b;

and then after some time... delete from test.

Now, how do i synchronize test on the target database again

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263

0 Answers0