0

How to restore some table from pg_dump custom format, and automatically create it's index ?

I just restore some tables from database dump (custom format).

pg_restore -d database --table=table1 --table=table2 --table=table3 dumpdatabase.dmp

This result tables with no index. I have to create manually each of them. How to automatically create it's index with pg_restore command ?

1 Answer 1

2

There is no way to do that. The best you can do is to create a table of contents with

pg_restore -l -f toc dumpdatabase.dmp 

Then edit toc and delete everything except the lines for the table and its indexes. Then you can restore only these objects with

pg_restore -L toc -d somedatabase -U postgres dumpdatabase.dmp 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.