I'm looking to copy a production postgres database to a development server. What's the quickest, easiest way to go about doing this?
                
                A: 
                
                
              
            For PostgreSQL you can use either of these operations
- replicate the database using Slony.
 - use dump and restore.
 
                  Space
                   2009-08-06 09:11:37
                
              
                +1 
                A: 
                
                
              pg_dump the_db_name > the_backup.sql
Then copy the backup to your development server, restore with:
psql the_new_dev_db < the_backup.sql
                  bvmou
                   2009-08-06 09:12:34
                
              Some one told me this can be problematic - permissions problems causing either the dump or restore to die when it hits a trigger?
                  
                   2009-08-06 09:26:41
                @rmbarnes: If there are problems - they have to be fixed. Without detailed knowledge what this "Some one" did - nobody can confirm nor dismiss this claim.
                  depesz
                   2009-08-06 10:06:57
                Use the --no-owner flag with pg_dump.  This skips the problem and the first edit of this post used it -- but then I thought you might need more precise fidelity to the original database.
                  bvmou
                   2009-08-06 17:05:43
                
                +2 
                A: 
                
                
              
            Use pg_dump, and later psql or pg_restore - depending whether you choose -Fp or -Fc options to pg_dump.
Example of usage:
ssh production
pg_dump -C -Fp -f dump.sql -U postgres some_database_name
scp dump.sql development:
rm dump.sql
ssh development
psql -U postgres -f dump.sql
                  depesz
                   2009-08-06 10:05:25
                
              
                +6 
                A: 
                
                
              You don't need to create an itermediate file. You can do
pg_dump -C -h localhost -U localuser dbname | psql -h remotehost -U remoteuser dbname
or
pg_dump -C -h remotehost -U remoteuser dbname | psql -h localhost -U localuser dbname
Using psql or pg_dump to connect to a remote host.
With a big database or a slow connection, dumping a file and transfering the file compressed may be faster.
Edit As porneL said there is no need to dump to a intermediate file, if you want to work compressed you can do with a compressed tunnel .
pg_dump -C dbname | bzip2 | ssh  remoteuser@remotehost "bunzip2 | psql dbname"
or pg_dump -C dbname | ssh -C remoteuser@remotehost "psql dbname"
But this solution also requires to get a session in both ends.
                  Ferran
                   2009-08-06 11:28:40
                
              There's no need for intermediate files - you may use compressed SSH tunnel or simply pipe: pg_dump | bzip2 | ssh "bunzip2 | pg_restore"
                  porneL
                   2009-08-06 12:46:17