Copy a table from one database to another in Postgres

前端 未结 19 1294
慢半拍i
慢半拍i 2020-11-28 00:21

I am trying to copy an entire table from one database to another in Postgres. Any suggestions?

19条回答
  •  广开言路
    2020-11-28 00:55

    To move a table from database A to database B at your local setup, use the following command:

    pg_dump -h localhost -U owner-name -p 5432 -C -t table-name database1 | psql -U owner-name -h localhost -p 5432 database2
    

提交回复
热议问题