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>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: PGUSER and initdb
Date: Wed, 11 Dec 2019 08:31:00 -0800
Message-ID: <8042e8d3-5528-c328-393f-218420aad4f5@aklaver.com> (raw)
In-Reply-To: <4624CAAA-6E67-42D8-9F66-D2EB926443CA@ya.ru>
References: <FC8A3161-2401-4786-B3BF-35F1422EE4CE@ya.ru>
	<61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com>
	<4624CAAA-6E67-42D8-9F66-D2EB926443CA@ya.ru>

On 12/11/19 5:18 AM, Олег Самойлов wrote:
> 
>> 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.
>> "
> 
> This is don't work with `initdb` and `pg_ctl initdb`.
> 

Hmm, yeah. So -U works but not the env variable. I would file a bug 
report(https://www.postgresql.org/account/login/?next=/account/submitbug/):

aklaver@tito:~> env | grep PGUSER
PGUSER=postgres

/usr/local/pgsql12/bin/initdb   -D pg_test_postgres/
/usr/local/pgsql12/bin/pg_ctl -D pg_test_postgres start

aklaver@tito:~> psql -d postgres -U postgres -p 5429
2019-12-11 08:25:22.334 PST [4978] FATAL:  role "postgres" does not exist
psql: error: could not connect to server: FATAL:  role "postgres" does 
not exist
aklaver@tito:~> psql -d postgres -U aklaver -p 5429
Null display is "NULL".
psql (12.1)
Type "help" for help.

postgres=# \du
                                    List of roles
  Role name |                         Attributes 
| Member of
-----------+------------------------------------------------------------+-----------
  aklaver   | Superuser, Create role, Create DB, Replication, Bypass RLS 
| {}


/usr/local/pgsql12/bin/initdb -U postgres  -D pg_test_postgres/

aklaver@tito:~> psql -d postgres -U postgres -p 5429
Null display is "NULL".
psql (12.1)
Type "help" for help.

postgres=# \du
                                    List of roles
  Role name |                         Attributes 
| Member of
-----------+------------------------------------------------------------+-----------
  postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS 
| {}



-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (6+ messages)  latest in thread

Message-ID: <8042e8d3-5528-c328-393f-218420aad4f5@aklaver.com>
Permalink:  ../8042e8d3-5528-c328-393f-218420aad4f5@aklaver.com/
Also on:    postgresql.org/message-id/8042e8d3-5528-c328-393f-218420aad4f5@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: <8042e8d3-5528-c328-393f-218420aad4f5@aklaver.com>
  References: <FC8A3161-2401-4786-B3BF-35F1422EE4CE@ya.ru> <61717e4b-3e69-2bb9-7ef8-1849a8900133@aklaver.com> <4624CAAA-6E67-42D8-9F66-D2EB926443CA@ya.ru> <8042e8d3-5528-c328-393f-218420aad4f5@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