Postgresql – pg_restore on a single table not restoring indexes

postgresql

If I use pg_restore to restore the complete database I get all indexes for the tables. But when I try to import a single table there are never any indexes.

to backup i run

pg_dump -Fc -w database > my_database.dump

to restore a single table i run

pg_restore -t table_name -s my_database.dump

Which only returns the create table statement and missing the indexs, where am I going wrong?

Best Answer

If you use -t, you limit the operation to the table you named. Indices are different objects and need to be selected with the -I (or --index=) selector.