Demonstrates how to use pg_dump
to dump database to either archive or editable SQL formats.
Environment Variables
Archive Database
pg_dump \ --blobs \ --format=custom \ --file="$PGDATABASE.pgd" \ --host=$PGHOST \ --port=$PGPORT \ --username=$PGUSER \ --password \ $PGDATABASE
Dump for Editing
pg_dump \ --clean \ --create \ --encoding=utf-8 \ --format=p \ --no-owner \ --no-privileges \ --column-inserts \ --quote-all-identifiers \ --file="$PGDATABASE.sql" \ --host=$PGHOST \ --port=$PGPORT \ --username=$PGUSER \ --password \ $PGDATABASE