1

I am attempting to prompt for a username and password when running a database creation script, and I want to hide any text input for my password prompt. In Oracle's sqlplus, I can use HIDE at the end of the line to suppress the user's input from appearing on the screen. Is there an equivalent for PostgreSQL's psql?

Current progress:

\prompt 'Enter database user password: ' ss_password
2
  • "\password username" will do it for changing a postgres users password. Is that workable in your script?
    – Philᵀᴹ
    Commented Apr 15, 2013 at 15:17
  • @Phil - It looks like that will work in my specific case. Thank you! I am still curious, though, if there is a way to suppress the input if I wasn't using the variable for a PostgreSQL user. Commented Apr 15, 2013 at 15:27

1 Answer 1

2
\password username

... will change the password for a given username, whilst suppressing the inputted password. I don't know of a way to do it for a given variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.