Kevin's answer provides an interactive solution.
Otherwise, you should use a non-interactive authentication method (for example, a .pgpass file).
My initial (and incorrect) suggestion was to enable the password customize-option in Mx customize-option RET sql-postgres-login-params RET .
The sql-*-login-params variables (and related widgets) are generalized across all types of databases; but not all of these options apply to all databases.
If applicable, passwords are read by Emacs and then used on the command line. However, psql does not allow you to enter a password as part of the command, so Emacs cannot use this approach here. This is why the password option is disabled for postgres login options.
phils source share