PostgreSQL portage: move table data from one server to another

Using the pg_dump command you can export individual table data and import to another server. I've found this useful for exporting data from a development database's tables to a staging server, all from the local development machine. To dump a table from the dev database:

$ pg_dump -h devserv djangodb -U postgres -a -t lookup_table -f devserv_djangodb_lookup_table.sql
  • -h is the host
  • -U is the user
  • -a skip the schema, just dump the data
  • -t is the table name
  • -f is the output file

The -i flag skips version mismatch between server and psql client if you need it To import the data into the staging db:

$ psql -h djangodb postgres < rootadunits.sql