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