Thread: pg_upgrade Only the install user can be defined in the new cluster

pg_upgrade Only the install user can be defined in the new cluster

From
Dávid Suchan
Date:
Hello, Im trying to upgrage the db version to a newer one with the command: 
'/usr/lib/postgresql/14/bin/pg_upgrade --old-bindir /usr/lib/postgresql/9.6/bin --new-bindir /usr/lib/postgresql/14/bin --old-datadir /etc/postgresql/9.6/main --new-datadir /var/lib/postgresql/14/data -U postgres' (logged as postgres user in ubuntu), but keep getting "Only the install user can be defined in the new cluster" error.
I cant understand why it fails, since I am upgrading as a superuser postgres, and there are no other users in the db. I ran 'SELECT rolname FROM pg_roles WHERE oid = 10' command which should confirm that postgres is the creator of the db and it definetly is.

The whole log:
Finding the real data directory for the source cluster      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 system-defined composite types in user tables  ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for user-defined encoding conversions              ok
Checking for user-defined postfix operators                 ok
Checking for incompatible polymorphic functions             ok
Checking for tables WITH OIDS                               ok
Checking for invalid "sql_identifier" user columns          ok
Checking for invalid "unknown" user columns                 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
Only the install user can be defined in the new cluster.
Failure, exiting

Re: pg_upgrade Only the install user can be defined in the new cluster

From
Daniel Gustafsson
Date:
> On 15 Mar 2023, at 10:30, Dávid Suchan <david.suchan@student.tuke.sk> wrote:

> ..there are no other users in the db.

The check in question performs this:

    SELECT COUNT(*) FROM pg_catalog.pg_roles WHERE rolname !~ '^pg_';

What do you get when running that in the new v14 cluster?

--
Daniel Gustafsson




Re: pg_upgrade Only the install user can be defined in the new cluster

From
Dávid Suchan
Date:
Can i create a brand new cluster and check it that way? Since I had to stop / shut down the 14 cluster in order to proceed with pg_upgrade and I dont know how can i connect to it now ...

Od: Dávid Suchan <david.suchan@student.tuke.sk>
Odoslané: streda 15. marca 2023 14:47
Komu: Daniel Gustafsson <daniel@yesql.se>
Predmet: Re: pg_upgrade Only the install user can be defined in the new cluster
 
Can i create a brand new cluster and check it that way? Since I had to stop / shut down the 14 cluster in order to proceed with pg_upgrade and I dont know how can i connect to it now ...

Od: Daniel Gustafsson <daniel@yesql.se>
Odoslané: streda 15. marca 2023 13:27
Komu: Dávid Suchan <david.suchan@student.tuke.sk>
Kópia: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Predmet: Re: pg_upgrade Only the install user can be defined in the new cluster
 
> On 15 Mar 2023, at 10:30, Dávid Suchan <david.suchan@student.tuke.sk> wrote:

> ..there are no other users in the db.

The check in question performs this:

        SELECT COUNT(*) FROM pg_catalog.pg_roles WHERE rolname !~ '^pg_';

What do you get when running that in the new v14 cluster?

--
Daniel Gustafsson

Re: pg_upgrade Only the install user can be defined in the new cluster

From
Daniel Gustafsson
Date:
> On 15 Mar 2023, at 14:48, Dávid Suchan <david.suchan@student.tuke.sk> wrote:
>
> Can i create a brand new cluster and check it that way? Since I had to stop / shut down the 14 cluster in order to
proceedwith pg_upgrade and I dont know how can i connect to it now ... 

Sure, create a new cluster in *same way* you will for the upgrade and control
that.

--
Daniel Gustafsson




Re: pg_upgrade Only the install user can be defined in the new cluster

From
Dávid Suchan
Date:
It prints out:
 count
-------
     1
(1 row)

Od: Daniel Gustafsson <daniel@yesql.se>
Odoslané: streda 15. marca 2023 13:27
Komu: Dávid Suchan <david.suchan@student.tuke.sk>
Kópia: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Predmet: Re: pg_upgrade Only the install user can be defined in the new cluster
 
> On 15 Mar 2023, at 10:30, Dávid Suchan <david.suchan@student.tuke.sk> wrote:

> ..there are no other users in the db.

The check in question performs this:

        SELECT COUNT(*) FROM pg_catalog.pg_roles WHERE rolname !~ '^pg_';

What do you get when running that in the new v14 cluster?

--
Daniel Gustafsson

Re: pg_upgrade Only the install user can be defined in the new cluster

From
Daniel Gustafsson
Date:
> On 15 Mar 2023, at 16:39, Dávid Suchan <david.suchan@student.tuke.sk> wrote:
>
> It prints out:
>  count
> -------
>      1

I have a feeling the cluster you tried to upgrade to doesn't match this one, as
the check that failed will fail on values other than 1.  Did you create them
equally?  If you try to upgrade into this cluster, even just with the --check
option, does that yield more success?

--
Daniel Gustafsson




Re: pg_upgrade Only the install user can be defined in the new cluster

From
Dávid Suchan
Date:
So I tried upgrading into this brand new cluster I created(using initdb -D /somedatapathichose). Running the upgrade with --check worked, it returned message that the clusters are identical. Then I stopped the new cluster, and ran the pg_upgrade without --check, which resulted in another:
Checking database user is the install user
Only the install user can be defined in the new cluster.
Failure, exiting
I dont know what to check for anymore, the log files dont say anything other than "Only the install user can be defined in the new cluster" when postgres is the install user everywhere.
The ' SELECT COUNT(*) FROM pg_catalog.pg_roles WHERE rolname !~ '^pg_'; ' prints count 4 and ' SELECT rolname FROM pg_roles WHERE oid = 10; ' prints rolname postgres.

Od: Daniel Gustafsson <daniel@yesql.se>
Odoslané: štvrtok 16. marca 2023 10:28
Komu: Dávid Suchan <david.suchan@student.tuke.sk>
Kópia: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Predmet: Re: pg_upgrade Only the install user can be defined in the new cluster
 
> On 15 Mar 2023, at 16:39, Dávid Suchan <david.suchan@student.tuke.sk> wrote:
>
> It prints out:
>  count
> -------
>      1

I have a feeling the cluster you tried to upgrade to doesn't match this one, as
the check that failed will fail on values other than 1.  Did you create them
equally?  If you try to upgrade into this cluster, even just with the --check
option, does that yield more success?

--
Daniel Gustafsson

Re: pg_upgrade Only the install user can be defined in the new cluster

From
Tom Lane
Date:
=?Windows-1252?Q?D=E1vid_Suchan?= <david.suchan@student.tuke.sk> writes:
> The ' SELECT COUNT(*) FROM pg_catalog.pg_roles WHERE rolname !~ '^pg_'; ' prints count 4

4?  That would be the problem all right.  What are those, that is what
do you get from

SELECT rolname FROM pg_catalog.pg_roles WHERE rolname !~ '^pg_';

on the new cluster?

            regards, tom lane



Re: pg_upgrade Only the install user can be defined in the new cluster

From
Daniel Gustafsson
Date:
> On 16 Mar 2023, at 15:56, Dávid Suchan <david.suchan@student.tuke.sk> wrote:
>
> So I tried upgrading into this brand new cluster I created(using initdb -D /somedatapathichose). Running the upgrade
with--check worked, it returned message that the clusters are identical. Then I stopped the new cluster, and ran the
pg_upgradewithout --check, which resulted in another: 
> Checking database user is the install user

pg_upgrade --check does not alter the new cluster in any way, so you must have
some form of processing on your system that configured the new cluster with
roles (and possibly other things) in between these runs.

--
Daniel Gustafsson




Re: pg_upgrade Only the install user can be defined in the new cluster

From
Dávid Suchan
Date:
 rolname
-----------
 anon
 api
 heartbeat
 postgres

only the default users..

Od: Tom Lane <tgl@sss.pgh.pa.us>
Odoslané: štvrtok 16. marca 2023 19:24
Komu: Dávid Suchan <david.suchan@student.tuke.sk>
Kópia: Daniel Gustafsson <daniel@yesql.se>; pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Predmet: Re: pg_upgrade Only the install user can be defined in the new cluster
 
Dávid Suchan <david.suchan@student.tuke.sk> writes:
> The ' SELECT COUNT(*) FROM pg_catalog.pg_roles WHERE rolname !~ '^pg_'; ' prints count 4

4?  That would be the problem all right.  What are those, that is what
do you get from

SELECT rolname FROM pg_catalog.pg_roles WHERE rolname !~ '^pg_';

on the new cluster?

                        regards, tom lane

Re: pg_upgrade Only the install user can be defined in the new cluster

From
"David G. Johnston"
Date:
On Monday, March 20, 2023, Dávid Suchan <david.suchan@student.tuke.sk> wrote:
 rolname
-----------
 anon
 api
 heartbeat
 postgres

only the default users..

You have an incorrect concept of default here.  Only postgres is installed by community PostgresSQL and thus pg_upgrade is rightfully complaining.

David J.

Re: pg_upgrade Only the install user can be defined in the new cluster

From
Dávid Suchan
Date:
I installed both postgres versions on ubuntu machine with 'apt-get install postgres', which installed both client and server packages. Is that where I made a mistake?

Od: David G. Johnston <david.g.johnston@gmail.com>
Odoslané: pondelok 20. marca 2023 14:57
Komu: Dávid Suchan <david.suchan@student.tuke.sk>
Kópia: Tom Lane <tgl@sss.pgh.pa.us>; Daniel Gustafsson <daniel@yesql.se>; pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Predmet: Re: pg_upgrade Only the install user can be defined in the new cluster
 
On Monday, March 20, 2023, Dávid Suchan <david.suchan@student.tuke.sk> wrote:
 rolname
-----------
 anon
 api
 heartbeat
 postgres

only the default users..

You have an incorrect concept of default here.  Only postgres is installed by community PostgresSQL and thus pg_upgrade is rightfully complaining.

David J.

Re: pg_upgrade Only the install user can be defined in the new cluster

From
"David G. Johnston"
Date:


On Monday, March 20, 2023, Dávid Suchan <david.suchan@student.tuke.sk> wrote:
I installed both postgres versions on ubuntu machine with 'apt-get install postgres', which installed both client and server packages. Is that where I made a mistake?


Any chance you can in-line/bottom-post like the rest of us?

Anyway, you had to have done more than that to use those other roles to appear in the new cluster.

David J.

Re: pg_upgrade Only the install user can be defined in the new cluster

From
Thorsten Glaser
Date:
On Mon, 20 Mar 2023, David G. Johnston wrote:

>On Monday, March 20, 2023, Dávid Suchan <david.suchan@student.tuke.sk>
>wrote:
>
>> I installed both postgres versions on ubuntu machine with 'apt-get install
>> postgres', which installed both client and server packages. Is that where I
>> made a mistake?

>Anyway, you had to have done more than that to use those other roles to
>appear in the new cluster.

And the Debian instructions are pretty clear, they tell one to
first drop the new version’s per-default-installed cluster then
upgrade the old cluster (into a fresh new one).

bye,
//mirabilos
--
15:41⎜<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)