Copy a table from one database to another in Postgres

前端 未结 19 1247
慢半拍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 01:05

    If the both DBs(from & to) are password protected, in that scenario terminal won't ask for the password for both the DBs, password prompt will appear only once. So, to fix this, pass the password along with the commands.

    PGPASSWORD= pg_dump -h  -U  -t  >  | PGPASSWORD= psql -h  -d  -U 
    

提交回复
热议问题