数据库用户“postgres”不是安装用户

时间:2017-01-25 14:42:07

标签: macos postgresql

我正在尝试将postgres从9.5升级到9.6。 brew upgrade postgresql成功,但在运行时

pg_upgrade -b /usr/local/Cellar/postgresql/9.5.3/bin/ -B /usr/local/Cellar/postgresql/9.6.1/bin/ -d /usr/local/var/postgres -D /usr/local/var/postgres9.6 -U postgres

我收到错误

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user
database user "postgres" is not the install user
Failure, exiting

最后在没有-U postgres的情况下进行尝试时,它会变得更奇怪

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* system OID user data types                ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for roles starting with 'pg_'                      ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user
database user "dimid" is not the install user

那怎么来

Checking database user is the install user                  ok

2 个答案:

答案 0 :(得分:3)

旧的PostgreSQL集群显然是用

创建的
byte[] originalBytes = ...
String string = new BigInteger(originalBytes).toString();
...
byte[] decodedBytes = new BigInteger(string).toByteArray();

但新群集与另一个超级用户进行了联系。

您必须使用与旧群集相同的超级用户名创建新群集。

答案 1 :(得分:0)

我得到这个是因为目标数据库包含一个额外的用户。

这以前是我安装和升级初始化脚本的一部分。我从升级 initdb 中删除了它,升级成功完成。