Re: Improving psql's \password command

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Bossart, Nathan" <bossartn@amazon.com>
Cc: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2021-11-19T17:15:57Z
Lists: pgsql-hackers
"Bossart, Nathan" <bossartn@amazon.com> writes:
> Okay, here is an attempt at adding control-C support for \prompt and
> \connect.  It was reasonably straightforward.  I did have to teach
> simple_prompt_extended() to add a newline after a cancellation when
> "echo" is true.

LGTM, pushed after very minor fooling with the comments.

> I think that's it for psql.  After a quick glance, I didn't see any
> other obvious candidates for control-C support, but I'll look a little
> closer to be sure.

Hmm, initdb's prompt-for-superuser-password might need it.
I think the rest of our frontend programs don't trap SIGINT,
or at least don't do so while requesting user input.

			regards, tom lane



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).