Postgres.app: pg_restore hangs

dB' picture dB' · Jun 26, 2013 · Viewed 10.5k times · Source

I'm trying to troubleshoot the pg_restore command on my system. I've installed Postgresapp, and I've included its binaries on my PATH. Commands such as psql and pg_dump appear to work fine, and running which pg_restore give the expected result.

$ which pg_restore
/Applications/Postgres.app/Contents/MacOS/bin/pg_restore

The problem is that pg_restore doesn't seem to do anything. When I run it in the terminal, no output is printed, eiher to the console or to the logs. This is true no matter what arguments I pass in, including the --verbose switch. Running it does cause a pg_restore process to appear in my activity monitor, but this process doesn't use any CPU. Apart from that, nothing happens at all.

Has anyone else seen this issue? Do you have any suggestions for getting pg_restore to work?

Answer

dB' picture dB' · Jun 26, 2013

I think I figured it out.

The command I was running included an extra line break after the user name.

As in, I was trying to execute this

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myusername
-d mydb latest.dump

instead of this

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myusername -d mydb latest.dump

For some reason that extra linebreak was gumming things up. Once I removed it pg_restore worked properly.