2

Been trying to pull my remote db into local env with heroku pg:pull, prior without problems, but at this point the command is returning this:

/bin/sh: pg_dump: command not found
 ▸    pg_dump errored with 127
pg_restore: [custom archiver] could not read from input file: end of file

looked for an answer here and updated the bash profile as some topics mention:

export PATH=/Applications/Postgres.app/Contents/Versions/10/bin:$PATH

rebooted and restarted terminal, but with no avail. anyone knows what's going on?

bjorn
  • 120
  • 1
  • 5
  • I think you will find your solution here https://stackoverflow.com/a/11391586/6392696 – nourza Oct 15 '18 at 08:17
  • 1
    Can confirm also having this issue. Making a manual backup, downloading from the Durability tab, and running pg_restore manually per @nourza's link seems to be working – btown Oct 15 '18 at 15:26
  • I will put it in new answer – nourza Oct 15 '18 at 17:35

2 Answers2

3

Ypsql tries to interpret SQL queries while you are adding it a compressed dump (heroku use this).

When You can not read the dump, pg_restore -O latest.dump gives you valid SQL you may pipe to psql

the easiest here :

pg_restore -O -d app_development latest.dump

Imporatant:

Try Use -O you may not use the random username of your remote heroku postgres db.

Check this link for more help here stackoverflow.com/a/11391586/6392696

nourza
  • 2,215
  • 2
  • 16
  • 42
  • thanks nourza this worked. will try later if I can still use the heroku pg:pull command line since it is so convenient – bjorn Oct 16 '18 at 04:09
0

Update your Heroku CLI; the issue where Postgres.app paths weren't being handled correctly was just fixed. https://github.com/heroku/cli/pull/1074

btown
  • 2,273
  • 3
  • 27
  • 38