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:
- connect to db1
- export the table contents using psql's
\copy
command (if you have access to the server, you can also use the SQL statementCOPY
- connect to db1
- import the text file using
\copy
orCOPY
depending on where the input file is located
精彩评论