I need to dump a postgres database from computer1 with postgres username1 and then restore it on computer2 with postgres username2. I keep running into the error that looks
The problem is with the dumping. With insight from this post I was able to resolve this using:
// On Computer1
pg_dump dbname -O -x > backupname.sql
// On Computer2
psql dbname < backupname.sql
The option flags used with pg_dump
are:
-O <-- No owner
Do not output commands to set ownership of objects to match the original database
-x <-- No privileges
Prevent dumping of access privileges (grant/revoke commands)
See the PostgreSQL docs for pg_dump for more info on the option flags.