开发者

How to use psql to copy rows?

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 ?


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


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜