pg_encrypt_password — Encrypt a password/username combination


pg_encrypt_password password username


pg_encrypt_password prepares the encrypted form of a PostgreSQL password. This is used to send encrypted (rather than clear-text) passwords to commands that can take a pre-encrypted password, such as ALTER ROLE.



The password to encrypt.


The username that goes with the password to encrypt.

Return Value

The encrypted password string.


The username is required because the encryption method uses both the username and password to form the encrypted password string.

This command was added in pgtclng-1.7.0 and in pgintcl-3.1.0.

This command uses or emulates the PostgreSQL libpq function PQencryptPassword. Logo

This version of the manual was produced for the Pgtcl-ng Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the Pgtcl-ng project downloads area.