May 2018
Intermediate to advanced
576 pages
30h 25m
English
If you've taken a logical backup using the pg_dump utility in a custom file, then you can simply extract the table you want from the dumpfile, like the following:
pg_restore -t mydroppedtable dumpfile | psql
Alternatively, you can directly connect to the database using -d.
The preceding command tries to recreate the table and then load data into it. Note that the pg_restore -t option does not dump any of the indexes on the selected table. This means we need a slightly more complex procedure than would first appear, and the procedure needs to vary depending on whether we are repairing a damaged table or putting back a dropped table.
To repair a damaged table, we want to replace the data in ...