How to restore a single table from a .sql postgresql backup?

前端 未结 7 606
耶瑟儿~
耶瑟儿~ 2020-12-09 04:19

A table\'s rows were mistakenly deleted from the database. We have a db backup which results in a sql file that can restored like so:

psql -h localhost -d pr         


        
相关标签:
7条回答
  • 2020-12-09 04:47

    There is an easy way.

    'pg_restore' has a '--table/-t' option.

    pg_restore -a -t your_table /path/to/dump.sql
    

    Use '-h' for remote host. See other options here

    0 讨论(0)
提交回复
热议问题