postgresql 我的 OSX Lion 上有 2 个版本的 pg_dump
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10635435/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
2 versions of pg_dump on my OSX Lion
提问by Andrey Eremin
I had Postgres 9.0.x installed with homebrew, but because of lack of some modules I removed it using:
我用自制软件安装了 Postgres 9.0.x,但由于缺少一些模块,我使用以下方法将其删除:
brew uninstall postgres
and installed Postgres 9.1.3 from http://www.enterprisedb.com/downloads/postgres-postgresql-downloads.
并从http://www.enterprisedb.com/downloads/postgres-postgresql-downloads安装了 Postgres 9.1.3 。
Now I've got a problem - 2 different versions on pg_dump - 9.0.5 and 9.1.3 and 9.0.5 is the default version.
现在我遇到了一个问题 - pg_dump 上有 2 个不同的版本 - 9.0.5 和 9.1.3 以及 9.0.5 是默认版本。
Is there any way to set the 9.1.3 version as the default version of pg_dump?
有什么办法可以将 9.1.3 版本设置为 pg_dump 的默认版本吗?
回答by Valentin Vasilyev
So based on your additional comments, your new version of pg_dump is not in your PATH, all you need to do is to remove the old version, and symlink the new one to any directory in your PATH, for example, /usr/bin.
因此,根据您的其他评论,您的 pg_dump 的新版本不在您的 PATH 中,您需要做的就是删除旧版本,并将新版本符号链接到 PATH 中的任何目录,例如/usr/bin。
Like follows:
像下面这样:
sudo ln -s /actual/new/pg_dump /usr/bin/pg_dump
Hope this helps
希望这可以帮助
回答by Henley Chiu
Valentin has the right answer, but of course, the question for Mac users is where the heck is pg_dump?
Valentin 有正确的答案,但当然,Mac 用户的问题是 pg_dump 到底在哪里?
If you have version 9.2, it's: /Library/PostgreSQL/9.2/bin/pg_dump
如果你有 9.2 版,它是:/Library/PostgreSQL/9.2/bin/pg_dump
Just copy this to /usr/bin
只需将其复制到 /usr/bin
回答by Paul Pettengill
I was having the same error essentially.
我基本上有同样的错误。
pg_dump: server version: 9.1.3; pg_dump version: 9.0.4
pg_dump: server version: 9.1.3; pg_dump version: 9.0.4
I just used homebrew's upgrade feature, and it brought both the sever and pg_dump versions up to date with the latest version in homebrew (9.3 as of 9/19/13).
我刚刚使用了自制软件的升级功能,它使 sever 和 pg_dump 版本都与自制软件的最新版本保持同步(9.3 截至 2013 年 9 月 19 日)。
brew upgrade postgresql
brew upgrade postgresql
I reran my dump statement, and it worked perfectly.
我重新运行了我的转储语句,它运行得很好。
pg_dump -U postgres development > dump.sql
pg_dump -U postgres development > dump.sql