Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg_restore unsupported version #440

Closed
smth opened this issue Apr 2, 2018 · 5 comments
Closed

pg_restore unsupported version #440

smth opened this issue Apr 2, 2018 · 5 comments

Comments

@smth
Copy link

smth commented Apr 2, 2018

I'm getting the pg_restore: [archiver] unsupported version (1.13) in file header error (as discussed here). All the info I can find about it says that it is resolved by updating postgres. As I understand it, this can be done by making sure that PostgressApp is up to date. PostgressApp is up to date in my case (2.1.3), yet I am getting the error. What am I missing?

pg_restore --version gives me pg_restore (PostgreSQL) 9.3.5 (it needs to be 9.3.22 to avoid this error I believe)

@jakob
Copy link
Member

jakob commented Apr 2, 2018

Type which pg_restore to see which pg_restore you are calling. You probably have multiple versions on your Mac. The one provided by Postgres.app can be found in /Applications/Postgres.app/Contents/Versions/latest/bin

Make sure to set up your $PATH correctly (see docs on our website)

@smth
Copy link
Author

smth commented Apr 2, 2018

Thanks @jakob that gets me a bit closer, I can see that the path isn't correct. However I have previously taken the steps (that I believe are intended) to configure the path, i.e
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp

I can confirm the paths.d directory exists, it contains a file named postgresapp, the contents of which is:

/Applications/Postgres.app/Contents/Versions/latest/bin

Yet my pg_restore path is /usr/local/php5/bin/pg_restore. Did I miss something?

Update: I'm guessing this is because in my .bash_profile I have

export PATH=/usr/local/php5/bin:$PATH

@jakob
Copy link
Member

jakob commented Apr 2, 2018

Your $PATH variable is probably also configured somewhere else (eg. in .profile or similar). If you want to use Postgres.app binaries, you need to make sure that their path is first in the $PATH variable. Unfortunately I don‘t have time right now to go into more detail, but I recommend to learn about how your shell uses the path variable, and the various ways in which it is typically configured on macOS.

@tbussmann
Copy link
Member

tbussmann commented Apr 2, 2018

You may find a start to understand how the PATH variable is constructed in issue #390
Seeing your 'Update:' it seems exactly as @jakob suggested: you prepend something to the path which seem to contain the postgres tools as well. If you append that instead you should be fine. But make sure the two instances are not interfering with each other.

@jakob jakob closed this as completed Apr 23, 2018
@d3v-studio
Copy link

You're using an old version of pg_restore binary that doesn't support restoring the provided dump file. Please make sure that you use the latest Postgres version, which must be higher than the following release: https://www.postgresql.org/about/news/1834/ (10.3, 9.6.8, 9.5.12, 9.4.17, and 9.3.22).

You can check the pg_restore version you're using by running pg_restore --version.

If you are using a third-party tool, such as PgAdmin, to restore the provided dump file, the restore may not succeed even with the installed Postgres version being up to date. This is due to third-party tools often bundling their own versions of the pg_restore binary, that may not be up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants