From 84ed09c72c72fac5d1492454a82e146ecacb01d5 Mon Sep 17 00:00:00 2001 From: Gurjeet Singh Date: Tue, 10 Oct 2023 01:14:49 -0700 Subject: [PATCH v4 08/11] Added documentation for ALTER ROLE command --- doc/src/sgml/ref/alter_role.sgml | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/doc/src/sgml/ref/alter_role.sgml b/doc/src/sgml/ref/alter_role.sgml index ab1ee45d54..459ea82a12 100644 --- a/doc/src/sgml/ref/alter_role.sgml +++ b/doc/src/sgml/ref/alter_role.sgml @@ -35,6 +35,9 @@ ALTER ROLE role_specification [ WIT | CONNECTION LIMIT connlimit | [ ENCRYPTED ] PASSWORD 'password' | PASSWORD NULL | VALID UNTIL 'timestamp' + | ADD { FIRST | SECOND } PASSWORD 'password' + | DROP { FIRST | SECOND | ALL } PASSWORD + | { FIRST | SECOND } PASSWORD VALID UNTIL 'timestamp' ALTER ROLE name RENAME TO new_name @@ -126,6 +129,14 @@ ALTER ROLE { role_specification | A set if a superuser issues the command. Only superusers can change a setting for all roles in all databases. + + + To support gradual password rollovers, PostgreSQL provides the ability to + store up to two passwords at the same time for each role. These passwords are + referred to as FIRST and SECOND + password. Each of these passwords can be changed independently, and each of + these can have their own password expiration time. + @@ -189,6 +200,34 @@ ALTER ROLE { role_specification | A + + ADD { FIRST | SECOND } PASSWORD 'password' + + + Set the first, or the second, password of the role. It is an error if the + corresponding password is already set. + + + + + + DROP { FIRST | SECOND | ALL } PASSWORD + + + Clear the first, the second, or all passwords of the role. + + + + + + { FIRST | SECOND } PASSWORD VALID UNTIL 'timestamp' + + + Sets a date and time after which the corresponding password is no longer valid. + + + + new_name @@ -335,6 +374,14 @@ ALTER ROLE worker_bee SET maintenance_work_mem = 100000; ALTER ROLE fred IN DATABASE devel SET client_min_messages = DEBUG; + + + Add a second password to a role: + + +ALTER ROLE fred ADD SECOND PASSwORD 'secret' SECOND PASSWORD VALID UNTIL '2005/01/01'; + + -- 2.41.0