psql patch for displaying the username when asking password

Started by Adrian Maierabout 21 years ago5 messagespatches
Jump to latest
#1Adrian Maier
adrian.maier@gmail.com

Hello all,

The attached patch modifies the message displayed by psql
when asking the password "Password: "
to include the username as well: "Password for user postgres : ".

Displaying the username is useful when running sql scripts
which are setting the session authorization (like the dump scripts
generated by older versions of pg_dump) and you don't have all the
usernames/passwords in ~/.pgpass.
In such cases it can happen that psql is asking several times :
Password:
Password:
Password:
Password:

and you don't know whether it's asking the pasword of the 'postgres' user
or the password of user that is importing the data .

I have the feeling that asking for "Password:" several times no longer
happens when running scripts generated by recent versions of pg_dump.
However, the patch might be useful for people who are upgrading .

Cheers,
Adrian Maier

Attachments:

psql_password_prompt.difftext/x-patch; name=psql_password_prompt.diffDownload+34-8
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Adrian Maier (#1)
Re: psql patch for displaying the username when asking password

Am Donnerstag, 30. Juni 2005 09:34 schrieb Adrian Maier:

The attached patch modifies the message displayed by psql
when asking the password "Password: "
to include the username as well: "Password for user postgres : ".

I can't decode your attachment so I don't know if this is a typo or actually
in the patch, but there shouldn't be a space after the user name.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#3Adrian Maier
adrian.maier@gmail.com
In reply to: Adrian Maier (#1)
Re: psql patch for displaying the username when asking password

On 6/30/05, Peter Eisentraut <peter_e@gmx.net> wrote:

Am Donnerstag, 30. Juni 2005 09:34 schrieb Adrian Maier:

The attached patch modifies the message displayed by psql
when asking the password "Password: "
to include the username as well: "Password for user postgres : ".

I can't decode your attachment so I don't know if this is a typo or
actually in the patch, but there shouldn't be a space after the user name.

There was a space there. I've removed the space between
username and colons. The space after the colons is ok, I hope ?

I'm attaching the modified patch.

Cheers,
Adrian Maier

Attachments:

psql_password_prompt_v2.diff.gzapplication/x-gzip; name=psql_password_prompt_v2.diff.gzDownload
#4Bruce Momjian
bruce@momjian.us
In reply to: Adrian Maier (#3)
Re: psql patch for displaying the username when asking password

Patch adjusted slightly, attached, and applied. Thanks.

---------------------------------------------------------------------------

Adrian Maier wrote:

On 6/30/05, Peter Eisentraut <peter_e@gmx.net> wrote:

Am Donnerstag, 30. Juni 2005 09:34 schrieb Adrian Maier:

The attached patch modifies the message displayed by psql
when asking the password "Password: "
to include the username as well: "Password for user postgres : ".

I can't decode your attachment so I don't know if this is a typo or
actually in the patch, but there shouldn't be a space after the user name.

There was a space there. I've removed the space between
username and colons. The space after the colons is ok, I hope ?

I'm attaching the modified patch.

Cheers,
Adrian Maier

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+30-8
#5Bruce Momjian
bruce@momjian.us
In reply to: Adrian Maier (#3)
Re: psql patch for displaying the username when asking password

Adrian Maier wrote:

On 6/30/05, Peter Eisentraut <peter_e@gmx.net> wrote:

Am Donnerstag, 30. Juni 2005 09:34 schrieb Adrian Maier:

The attached patch modifies the message displayed by psql
when asking the password "Password: "
to include the username as well: "Password for user postgres : ".

I can't decode your attachment so I don't know if this is a typo or
actually in the patch, but there shouldn't be a space after the user name.

There was a space there. I've removed the space between
username and colons. The space after the colons is ok, I hope ?

I'm attaching the modified patch.

I made this adjustment in the applied version. Thanks.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073