Using pg_dump to only get insert statements from one table within database

前端 未结 4 1642
猫巷女王i
猫巷女王i 2020-12-22 17:19

I\'m looking for a way to get all rows as INSERT statements from one specific table within a database using pg_dump in PostgreSQL.

E.g., I

4条回答
  •  执笔经年
    2020-12-22 18:11

    just in case you are using a remote access and want to dump all database data, you can use:

    pg_dump -a -h your_host -U your_user -W -Fc your_database > DATA.dump

    it will create a dump with all database data and use

    pg_restore -a -h your_host -U your_user -W -Fc your_database < DATA.dump

    to insert the same data in your data base considering you have the same structure

提交回复
热议问题