How to fix pg_dump version mismatch errors?

强颜欢笑 提交于 2019-11-27 12:05:43

OS X 10.8 comes with pg_dump version 9.1.4 in the /usr/bin directory, along with psql and other programs that are client-side PostgreSQL tools. It does not mean that PostgreSQL as a server is installed (unless you have OS X Server Edition). So you don't have to uninstall PostgreSQL because it's not installed and it's better not to remove these postgres client tools in /usr/bin because they belong to the system as shipped by Apple. They just need to be side-stepped.

The package provided by postgres.app comprises both the PostgreSQL server and the client-side tools of the same version as this server. These tools get installed in /Applications/Postgres.app/Contents/MacOS/bin

To use these instead of the 9.1 ones from Apple when you work in a Terminal, postgres.app documentation says to do:

PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

and put it in your .profile file.

Once you have done that and you run pg_dump, you should no longer get the error that's it's the wrong version, because it would be the one that ships with postgres.app (currently 9.2.2).

I have this setup and it works OK for me.

drjorgepolanco

If you only need to upgrade your pg_dump to the latest version and you have homebrew and mac, if the app has the latest version and your local pg doesn't:

brew upgrade postgresql

user1322092

If you're using postgresapp 9.3.x, the path is different. The following worked for me (courtesy of http://sigmyers.com/blog/2013/3/12/postgres-pgdump-version-mismatch-error-postgresapp-postgresappcom)

export PG_BIN_PATH="/Applications/Postgres.app/Contents/Versions/9.3/bin/"
PATH=$PG_BIN_PATH:$PATH

Check here for the latest path: http://postgresapp.com/documentation/cli-tools.html

samvax

I'm running Mountain Lion Server. My PostgeSQL server is at version 9.2.1 and the default tools are at 9.1.5.

I had to use:

PATH="/Applications/Server.app/Contents/ServerRoot/usr/bin:$PATH"

to make it work.

Yep, sometimes if you run Postgres.app this may happen after upgrade. Make sure you restart your Postgres.app - it will update your PATH.

In my case I have postgresql installed via homebrew and the executables are here: /usr/local/opt/postgresql@9.6/bin

Or you copy the dump and restore executions to the /Applications/Postgres.app/Contents/SharedSupport folder

or in PdAgmin you point the PG bin Path (in properties -> binary Path) to the path of the executables of your postgre

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!