Update staging data with production data in Postgresql
Update Oct. 30, 2015: This answer is simpler and more accurate than my old answer, which I removed for the sake of brevity. To see the old answer, take a look at the edit history.
- As production user:
pg_dump -Fc my_prod_db > prod_dump.db
- Drop and create staging database
- As staging user:
pg_restore --no-owner --dbname my_staging_db path/to/prod_dump.db