From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: rhpatrick@gmail.com
Subject: BUG #15961: psql should be able to read password from stdin
Date: Fri, 16 Aug 2019 14:20:55 +0000
Message-ID: <15961-a17e673003b92f17@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15961
Logged by: Robert Patrick
Email address: rhpatrick@gmail.com
PostgreSQL version: 11.4
Operating system: Amazon Linux
Description:
I understand why psql does not include a mechanism to pass the password on
the command-line. Having worked with and built other similar applications
at Oracle, I tried to pipe the password into stdin of the psql command like
so:
echo P0stgr3s | psql --username=postgres
Unfortunately, psql ignores it and prompts me for the password.
My use case is that I am writing terraform scripts to standup Sonarqube in
AWS. After creating the AWS RDS PostgreSQL database, I need to be able to
create the sonarqube user and grant access to the sonarqube database that
was created with the RDS instance. I can work around this using the
PGPASSWORD environment variable but that seems to be deprecated. I don't
want to use the .pgpass solution since I don't want/need the postgres user's
credentials in my EC2 instance where the Sonarqube server will be running...
psql should really accept the value for the password prompt from stdin.
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-bugs@postgresql.org
Cc: noreply@postgresql.org, rhpatrick@gmail.com
Subject: Re: BUG #15961: psql should be able to read password from stdin
In-Reply-To: <15961-a17e673003b92f17@postgresql.org>
References: <15961-a17e673003b92f17@postgresql.org>
* 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