Sample Header Ad - 728x90

PostgreSQL Dump with replace statement

0 votes
0 answers
65 views
have two PostgreSQL servers, A and B. Some tables from Server A need to be replicated or synced to Server B. If the data in these tables on Server A is modified, I want those updates to be reflected on Server B as well. In other cases, there are tables where data is inserted or modified independently on both servers, A and B. In this scenario, I want to push the changes from Server B to Server A, ensuring the updates are synchronized. When I was using MySQL, I achieved this using the following command:
--login-path=xyz --no-create-info --replace db t1 t2 t3 > a.sql
This allowed me to create a dump where: New records were inserted. Existing records were updated (thanks to the --replace option). After restoring this dump, it worked seamlessly. I now want to achieve a similar workflow and impact with PostgreSQL. However, I am new to PostgreSQL and need guidance on how to set this up effectively.
Asked by Baran (133 rep)
Nov 15, 2024, 09:52 AM