Back up your Drupal database with PostgreSQL
There several ways to do a database backup. E.g.,
pg_dump -U [user] -h [host] [databasename] > dump.sql
or
pg_dump -U [user] -W -h [host] [databasename] -F c > dump.pg_restore.format
The former you can restore by running the script with psql, the latter by using the pg_restore utility.
For huge databases, the second method is nice because it is automatically compressed. Alternatively, pipe to gzip:
pg_dump -U [user] -W -h [host] [databasename] | gzip -c > dump.sql.gz
and to restore:
gunzip -c dump.sql.gz | psql [options]