PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15961
PG Version11.4
OSAmazon Linux
Opened2019-08-16 14:20:55+00
Reported byRobert Patrick
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15961
Logged by:          Robert Patrick
Email address:      (redacted)
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.

Messages

DateAuthorSubject
2019-08-16 14:20:55+00PG Bug reporting formBUG #15961: psql should be able to read password from stdin
2019-08-19 07:15:54+00Peter EisentrautRe: BUG #15961: psql should be able to read password from stdin
2019-08-19 09:40:05+00Arthur ZakirovRe: BUG #15961: psql should be able to read password from stdin
2019-08-19 14:07:25+00Tom LaneRe: BUG #15961: psql should be able to read password from stdin
2019-08-19 14:18:24+00Thomas KellererRe: BUG #15961: psql should be able to read password from stdin
2019-08-24 08:44:20+00Georg SauthoffRe: BUG #15961: psql should be able to read password from stdin