0

I have 2 dbs on two different servers.

How can I copy using psql all the missing rows from db1 table to db2 table ? If this is not possible.. How can I copy the entire table ?

2 Answers 2

1

Can you use a contrib module? If so, how about trying dblink. More information here

Sign up to request clarification or add additional context in comments.

Comments

0

This is not possible with psql directly using a single SQL statement because you cannot connect to two different servers at the same time.

The only way you can do it:

  1. connect to db1
  2. export the table contents using psql's \copy command (if you have access to the server, you can also use the SQL statement COPY
  3. connect to db1
  4. import the text file using \copy or COPY depending on where the input file is located

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.