Re: BUG #15961: psql should be able to read password from stdin - Mailing list pgsql-bugs

From Peter Eisentraut
Subject Re: BUG #15961: psql should be able to read password from stdin
Date
Msg-id 3ea347a8-ffc6-cab7-1c32-a2311739a511@2ndquadrant.com
Whole thread Raw
In response to BUG #15961: psql should be able to read password from stdin  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On 2019-08-16 16:20, PG Bug reporting form wrote:
> 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.

The stdin for psql is already used for feeding SQL commands to execute
(e.g., psql < file.sql), so we can't also use it for getting a password.

It might be possible to create a new option to get the password from a
file descriptor (different from stdin), but that's not a feature that
exists today.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #15959: 'DROP EXTENSION pglogical' while an unused logicalreplication slot exists causes slot corruption
Next
From: Arthur Zakirov
Date:
Subject: Re: BUG #15961: psql should be able to read password from stdin