PG: Dump And Restore Table

Dump a single table

pg_dump -U postgres --table feedbacks -Fc staging_db > feedbacks.sql

-Fc means the archive format is custom.

If you have below error message, definitely is forget add -U options.

pg_dump: [archiver (db)] connection to database "staging_db" failed: FATAL: password authentication failed for user "root"`, if you have above error message, definitely is forget add -U options

Restore a single table

pg_restore -U postgres --dbname test_production  --table=feedbacks feedbacks.sql

Reference: