Heroku Postgres fails to pull and push on windows

Viewed 683

As you read it, the problem is simple as that. I figured out the solution myself so I'm posting this question for our fellows out there struggling with heroku postgres. Describing my problem: I have the same PostgreSQL version on my local machine and Heroku app.

  1. push and pull: the cli run until it came to the
pg_restore:  processing data for table "public.posts"
pg_restore: error: unrecognized data block type (0) while searching archive
 !    pg_restore errored with 1
  1. I tried to work around for the push problem with pg_dump my local db and then use heroku pg:backups:restore <backup file url> -a my-app as Heroku instructed in their blog. I did 99% the same with the instructions from Heroku themselves, only with 1 small change that I didn't have my output dump file named file.dump as they did. Actually there's no file extension at all, in order for the pg:backups:restore to work.

  2. Another problem was actually getting my local db synced with heroku, manually of course, the pull didn't work out as mentioned in #1. So I made a backup of my heroku app database with pg:backups:capture and download it with pg:backups:download. Things could work out but it was the credentials stopped me to restore my local db with that backup file.

2 Answers

Having the same "pg_restore errored with 1" issue with Heroku pg:push and Postgresql 13.1. Local system:

pg_restore --version pg_restore (PostgreSQL) 13.1

Heroku response: heroku run pg_restore --version Running pg_restore --version on ⬢ ... up, run.5138 (Free) pg_restore (PostgreSQL) 12.5 (Ubuntu 12.5-1.pgdg18.04+1)

even though:

heroku pg:info === DATABASE_URL Plan: Hobby-dev Status: Available Connections: 0/20 PG Version: 13.1 Created: 2020-12-31 01:55 UTC Data Size: 8.0 MB

Seems like Heroku has a mismatched version for pg_restore of 12.5 for postgresql of 13.1.

#2 is solved completely. #1 and #3 need future updates from Heroku after they accepting my issue tickets.

Related