Postgres – pg_dump for specific tables

Use the following to get specific table dumps from a database (To be executed from shell and not from SQL prompt).

pg_dump [--schema-only] -t tableName DbName -U userName -h localhost -W > tmp.sql

-W signifies prompt for password.
–schema-only is optional. Use if only table definition is required.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.