Database user "postgres" is not an installation user

I am trying to upgrade postgres from 9.5 to 9.6. brew upgrade postgresqlsucceeds but at startup

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

I get an error

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

when you try without -U postgresin the end it becomes even stranger

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

So how did it happen

Checking database user is the install user                  ok
+4
source share
2 answers

The old PostgreSQL cluster was obviously created using

initdb -U dimid

but the new cluster was configured with a different superuser.

You need to create a new cluster with the same superuser name as the old one.

+3
source

, postgresql homebrew, initdb $USER - , -

initdb /usr/local/var/postgres -E utf8

Unix. "rob", "-U rob" pg_upgrade :

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
+2

Source: https://habr.com/ru/post/1667777/


All Articles