且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何修复pg_dump版本不匹配错误?

更新时间:2023-02-02 20:27:20

OS X 10.8随附 / usr / bin 目录中的 pg_dump 版本9.1.4,以及 psql 和其他作为客户端 PostgreSQL工具的程序。这并不意味着已安装PostgreSQL作为服务器(除非您具有OS X Server Edition)。
所以您不必卸载PostgreSQL,因为它尚未安装,***不要在 / usr / bin 中删除​​这些postgres客户端工具。苹果公司提供的系统。

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.

postgres.app提供的软件包包括PostgreSQL服务器和与此服务器相同版本的客户端工具。这些工具安装在 /Applications/Postgres.app/Contents/MacOS/bin

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

在终端中工作时来自Apple的9.1版本,postgres.app 文档说:

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"

并将其放在您的 .profile 文件中。

and put it in your .profile file.

完成此操作并运行 pg_dump 后,您不应再收到错误消息,因为它是错误的版本,因为它将是postgres附带的版本.app(当前为9.2.2)。

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.