Postgresql – How to restore a .backup file from a single table on postgres

backupdumppostgresql

I have a .backup dump from a single table, but it didn't work restore like a normal backup from an entire db. I'm creating this backup file with the following batch script bin\pg_dump -h localhost -p 5432 -U postgres -F c -b -v -f %BACKUP_FILE% --table <schema.table-name> <db-name> And i'm restoring it with the pgadmin restore option, i didn't get any error message, the restore run normally, but the table don't show on my db/schema.

Best Answer

I am not sure what you tried so far, please post error message for better understanding,

Try below and post a comment if this works for you or not.

you can use pg_restore to restore a single table :

pg_restore -t my_table -d database_name database.dump

If the dump is not too big, the easiest thing to do is restore the full backup to a temporary database (gzcat backup_file.gz | psql -h host -U user database_name) dump the one table (pg_dump -t my_table), then restore it.