postgresql 如何在 Postgres.app 中降级/拥有以前版本的 Postgres DB
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31235074/
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
How to downgrade/have a previous version of Postgres DB in Postgres.app
提问by Grinch
I have installed Postgres.app from here (http://postgresapp.com) a couple of days ago. It comes with Postgres 9.4.4.
几天前,我从这里 ( http://postgresapp.com)安装了 Postgres.app 。它随 Postgres 9.4.4 一起提供。
Today I realised that the software I am using officially supports only Postgres 9.3. The 9.4.4 version works, but sometimes there are DB locks.
今天发现我用的软件官方只支持Postgres 9.3。9.4.4 版本有效,但有时会有 DB 锁。
Is there a way to downgrade my current db (very small in size, created just for testing), which is version 9.4.4 to 9.3? Or is it possible to create another DB with version 9.3 without uninstalling current version of Postgres.app?
有没有办法降级我当前的数据库(大小非常小,仅为测试而创建),即版本 9.4.4 到 9.3?或者是否可以在不卸载当前版本的 Postgres.app 的情况下使用 9.3 版创建另一个数据库?
OS: OS X Yosemite 10.10.4
操作系统:OS X Yosemite 10.10.4
Thank you.
谢谢你。
采纳答案by Vao Tsun
- install postgres 9.3 server and client to your mac
- run
locate initdb
expected in/Library/PostgreSQL/9.3/bin/initdb
let's assume it is there - create 9.3 instance
/Library/PostgreSQL/9.3/bin/initdb -D /new_data_directory
- export 9.4 db
/Library/PostgreSQL/9.3/bin/pg_dump -U 94_username -d 94_database >somefile.dmp
- shutdown old
/Library/PostgreSQL/9.4/bin/pg_ctl stop -m fast
- startup new
/Library/PostgreSQL/9.3/bin/pg_ctl start
7.create 93 db/Library/PostgreSQL/9.3/bin/psql -U 93_superuser_user -c "create database IMPORT_DB"
- import 93 db
/Library/PostgreSQL/9.3/bin/psql -U 93_superuser_user -f somefile.dmp IMPORT_DB
- 将 postgres 9.3 服务器和客户端安装到您的 mac
- 运行
locate initdb
预期/Library/PostgreSQL/9.3/bin/initdb
让我们假设它在那里 - 创建 9.3 实例
/Library/PostgreSQL/9.3/bin/initdb -D /new_data_directory
- 导出 9.4 分贝
/Library/PostgreSQL/9.3/bin/pg_dump -U 94_username -d 94_database >somefile.dmp
- 关机旧
/Library/PostgreSQL/9.4/bin/pg_ctl stop -m fast
- 启动新
/Library/PostgreSQL/9.3/bin/pg_ctl start
7.create 93 db/Library/PostgreSQL/9.3/bin/psql -U 93_superuser_user -c "create database IMPORT_DB"
- 进口 93 分贝
/Library/PostgreSQL/9.3/bin/psql -U 93_superuser_user -f somefile.dmp IMPORT_DB
I don't know if there are articles on this topic. I know I sound old fashion, but maybe manuals? :) and experience
不知道有没有这方面的文章。我知道我听起来过时了,但也许是手册?:) 和经验
回答by Stephen Karger
If you need to downgrade the Postgres version but prefer to continue using Postgres.app, there are previous releases recorded at https://github.com/PostgresApp/PostgresApp/releases/including links to the dmg
or older zip
installers.
如果您需要降级 Postgres 版本但更愿意继续使用 Postgres.app,可以在https://github.com/PostgresApp/PostgresApp/releases/上记录以前的版本,包括指向dmg
旧zip
安装程序的链接。
For example in August 2017 the current Postgres.app (v2.0.4
) uses Postgres version 9.6.4
. However if you needed say Postgres 9.6.2
you could page back through the previous releases to find that the v.2.0.2
release from Feb 2017 uses Postgres 9.6.2
.
https://github.com/PostgresApp/PostgresApp/releases/tag/v2.0.2
例如在 2017 年 8 月,当前的 Postgres.app( v2.0.4
) 使用 Postgres 版本9.6.4
。但是,如果您需要说 Postgres,9.6.2
您可以翻阅以前的版本,以发现v.2.0.2
2017 年 2 月的版本使用 Postgres 9.6.2
。
https://github.com/PostgresApp/PostgresApp/releases/tag/v2.0.2
Older versions of Postgres are there too even back to the 9.3
series referenced in the original question.
旧版本的 Postgres 甚至可以追溯到9.3
原始问题中引用的系列。
I'm not sure if the old installers are "officially" provided by Postgres.app. I couldn't find any mention of them on http://postgresapp.com/. Just noticed the releases history on Github.
我不确定 Postgres.app 是否“正式”提供旧的安装程序。我在http://postgresapp.com/上找不到任何关于它们的提及。刚刚注意到 Github 上的发布历史。