ALTER USER

Function

ALTER USER modifies the attributes of a database user.

Precautions

Session parameters modified by ALTER USER apply to the specified user and take effect in the next session.

Syntax

Parameters

Example

Create an example user u1:

1
2
DROP USER IF EXISTS u1;
CREATE USER u1 PASSWORD '{Password}';

Change the login password of user u1:

1
ALTER USER u1 IDENTIFIED BY '{new_Password}' REPLACE '{Password}';

Add the CREATEROLE permission to user u1:

1
ALTER USER u1 CREATEROLE;

Set the enable_seqscan parameter associated with user jim to u1. The setting takes effect in the next session.

1
ALTER USER u1 SET enable_seqscan TO on;

Reset the enable_seqscan parameter for user u1.

1
ALTER USER u1 RESET enable_seqscan;

Lock account u1:

1
ALTER USER u1 ACCOUNT LOCK;

Links

CREATE ROLE, CREATE USER, DROP USER