Transfer data between databases with PostgreSQL

前端 未结 9 1458
我寻月下人不归
我寻月下人不归 2020-12-22 17:51

I need to transfer some data from another database. The old database is called paw1.moviesDB and the new database is paw1. The schema of each table are the following.

<
9条回答
  •  礼貌的吻别
    2020-12-22 18:01

    This worked for me to copy a table remotely from my localhost to Heroku's postgresql:

    pg_dump -C -t source_table -h localhost source_db | psql -h destination_host -U destination_user -p destination_port destination_db

    This creates the table for you.

    For the other direction (from Heroku to local) pg_dump -C -t source_table -h source_host -U source_user -p source_port source_db | psql -h localhost destination_db

提交回复
热议问题