RefLib

Reference library for AI

Back

postgresql_16:7.1.24.4 Examples

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

Change a role's password: ALTER ROLE davide WITH PASSWORD 'hu8jmn3';

Remove a role's password: ALTER ROLE davide WITH PASSWORD NULL;

Change a password expiration date, specifying that the password should expire at midday on 4th May 2015 using the time zone which is one hour ahead of UTC: ALTER ROLE chris VALID UNTIL 'May 4 12:00:00 2015 +1';

Make a password valid forever: ALTER ROLE fred VALID UNTIL 'infinity';

Give a role the ability to manage other roles and create new databases: ALTER ROLE miriam CREATEROLE CREATEDB;

Give a role a non-default setting of the (see guc-maintenance-work-mem) parameter: ALTER ROLE worker_bee SET maintenance_work_mem = 100000;

Give a role a non-default, database-specific setting of the (see guc-client-min-messages) parameter: ALTER ROLE fred IN DATABASE devel SET client_min_messages = DEBUG;

Back