pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Олег Самойлов <splarv@ya.ru>
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: PGUSER and initdb
Date: Tue, 10 Dec 2019 08:05:11 -0800
Message-ID: <61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com> (raw)
In-Reply-To: <FC8A3161-2401-4786-B3BF-35F1422EE4CE@ya.ru>
References: <FC8A3161-2401-4786-B3BF-35F1422EE4CE@ya.ru>

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.klaver@aklaver.com





view thread (6+ messages)  latest in thread

Message-ID: <61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com>
Permalink:  ../61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com/
Also on:    postgresql.org/message-id/61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, splarv@ya.ru
  Subject: Re: PGUSER and initdb
  In-Reply-To: <61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com>
  References: <FC8A3161-2401-4786-B3BF-35F1422EE4CE@ya.ru> <61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox