RefLib

Reference library for AI

Back

postgresql_16:7.1.24.3 Notes

PostgreSQL 16 > Reference > SQL Commands > ALTER ROLE > Notes

Use CREATE ROLE (see postgresql_16:7.1.76) to add new roles, and DROP ROLE (see postgresql_16:7.1.124) to remove a role.

ALTER ROLE cannot change a role's memberships. Use GRANT (see postgresql_16:7.1.148) and REVOKE (see postgresql_16:7.1.164) to do that.

Caution must be exercised when specifying an unencrypted password with this command. The password will be transmitted to the server in cleartext, and it might also be logged in the client's command history or the server log. (see postgresql_16:7.2.18) contains a command \password that can be used to change a role's password without exposing the cleartext password.

It is also possible to tie a session default to a specific database rather than to a role; see (see postgresql_16:7.1.5). If there is a conflict, database-role-specific settings override role-specific ones, which in turn override database-specific ones.

Back