Re: BUG #15961: psql should be able to read password from stdin

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: rhpatrick(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15961: psql should be able to read password from stdin
Date: 2019-08-19 07:15:54
Message-ID: 3ea347a8-ffc6-cab7-1c32-a2311739a511@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Arthur Zakirov 2019-08-19 09:40:05 Re: BUG #15961: psql should be able to read password from stdin
Previous Message Peter Eisentraut 2019-08-19 07:12:25 Re: BUG #15959: 'DROP EXTENSION pglogical' while an unused logical replication slot exists causes slot corruption