Re: PGUSER and initdb

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Олег Самойлов <splarv(at)ya(dot)ru>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: PGUSER and initdb
Date: 2019-12-10 16:05:11
Message-ID: 61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/10/19 5:21 AM, Олег Самойлов wrote:
> PGUSER doesn't work with initdb and pg_ctl initdb. Lets explain, where this can be important. For instance in MacOS the most convenient way to manage PostgresQL is homebrew.
>
> To install PostgresQL:
>
> brew install postgresql
>
> To upgrade:
>
> brew upgrade postgresql
>
> this will upgrade soft and to upgrade DB
>
> brew postgresql-upgrade-database
>
> The later command do: install previous version of PostgresQL, move postgresql dir to postgesql.old, run pg_upgrade and so on. Convenient.
>
> But this command don't have option to define name of superuser. The only variant to set name off superuser is to use PGUSER environment variable. But PGUSER understand only pg_upgrade, but not initdb.

Hmm:

https://www.postgresql.org/docs/12/app-initdb.html
"
-U username
--username=username

Selects the user name of the database superuser. This defaults to
the name of the effective user running initdb. It is really not
important what the superuser's name is, but one might choose to keep the
customary name postgres, even if the operating system user's name is
different.

...

This utility, like most other PostgreSQL utilities, also uses the
environment variables supported by libpq (see Section 33.14).
"

https://www.postgresql.org/docs/12/libpq-envars.html
"
PGUSER behaves the same as the user connection parameter.
"

Seems to me this is something that you need to bring up with the Brew
maintainers.

>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-12-10 16:08:02 Re: pgpool-II 3.7.5 with ssl
Previous Message Adrian Klaver 2019-12-10 15:59:08 Re: PostgreSQL vs PostgresQL