Re: Improving psql's \password command

Nathan Bossart <bossartn@amazon.com>

From: "Bossart, Nathan" <bossartn@amazon.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2021-11-12T17:23:58Z
Lists: pgsql-hackers

Attachments

On 11/11/21, 8:12 AM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
> It seems to me it'd overcomplicate simple_prompt's API for one use-case
> ... but if you want to try it, step right up.  (I suppose some of that
> objection could be overcome by making simple_prompt into a wrapper
> around another function not_so_simple_prompt.)

I haven't started on the SIGINT stuff yet, but I did extract the
PQuser() fix so that we can hopefully get that one out of the way.  I
made some small adjustments in an attempt to keep the branching in
this function from getting too complicated.

Nathan

Commits

  1. pg_receivewal, pg_recvlogical: allow canceling initial password prompt.

  2. Allow psql's other uses of simple_prompt() to be interrupted by ^C.

  3. Provide a variant of simple_prompt() that can be interrupted by ^C.

  4. Make psql's \password default to CURRENT_USER, not PQuser(conn).