Alter User
Modifies user properties and permissions.
Synopsis
ALTER USER username [ WITH PASSWORD 'password' ] [ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ] [ VALID UNTIL 'abstime' ]
Parameters & Keywords
usernameThe name of the PostgreSQL database user to be modified.
passwordAn optional new password to assign to the modified PostgreSQL user.
CREATEDB | NOCREATEDBThe privilege to create new databases. Use
CREATEDB, to give the user permission to create databases. UseNOCREATEDBto explicitly deny that permission (which is the default).CREATEUSER | NOCREATEUSERThe superuser privilege. The use of
CREATEUSERallows access to both theCREATE USERandDROP USERcommands, as well as makes the user a superuser (with universal rights across all databases).NOCREATEUSERis the default.Specifying that a PostgreSQL user is able to create other users also automatically classifies the user as a superuser in the database; this can be a security risk if unintentional. A superuser can override all other access restrictions.
abstimeThe timestamp that defines when a user’s password expires. When the date and time defined by
abstimeis reached, the user’s defined password will become invalid. If unset, the password never expires.
Results
ALTER USERThe message returned when the
ALTER USERcommand is successful.ERROR: ALTER USER: user "username" does not existThe error returned if
usernamedoes not exist in thepg_shadowusers table.
Description
Use the ALTER USER to change the attributes and permissions ...