2017-01-25 2 views
3

私はpostgresを9.5から9.6にアップグレードしようとしています。 brew upgrade postgresqlは成功しますが、データベースユーザー "postgres"はインストールユーザーではありません

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ずにしようとしたとき、どのように

Checking database user is the install user     ok 
を来るそれも奇妙

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 

を取得を取得します

答えて

2

古いPostgreSQLのクラスタは明らかに

initdb -U dimid 

で作成されましたが、新しいクラスタは、異なるスーパーユーザでistalledました。

新しいクラスタは、古いクラスタと同じスーパーユーザー名で作成する必要があります。

+0

おかげで、どのように私は、クラスタを作成したユーザーを見つけることができますか? – dimid

+1

あなたは 'SELECT rolname FROM pg_roles WHERE oid = 10'でそれを行いますが、それは必要ではありません。新しいクラスタを削除し、 '-U dimid'で再作成してください。 –

+0

ありがとう、それはトリックでした。好奇心から、「10」は何を指していますか? – dimid

2

は、具体的に自作のPostgreSQLのインストールのために、initdbのためのデフォルトのユーザーは$ USERある - ので、あなただけの最初に指示に従ったと

​​

のような何かをした場合、ユーザーは自分のUnixのユーザ名でインストールします。私の場合、それは「強盗」であり、これだけpg_upgradeのに「-U奪う」を追加すると、同様に動作します

pg_upgrade -b /usr/local/Cellar/postgresql/9.5.4_1/bin -B /usr/local/Cellar/postgresql/9.6.2/bin -d /usr/local/var/postgres95 -D /usr/local/var/postgres -U rob 
+0

他の多くの場合、ユーザーはpostgresかもしれないので、このエラーメッセージにはインストールユーザーではなくあなたの名前が表示されます。 – engineerDave

+0

はい、 'postgres'はデフォルトのインストールユーザーです。私のようなユーザーが最初に試してみます。この回答に記載されているように、最初のinitdbに$ USERを使用するのは、OSX/MacOS上のPostgreSQLの自作インストールに固有です。 – robm

関連する問題