ALTER USER … MODIFY KEY PAIR¶
Changes the name of a key pair or a property of the key pair.
Syntax¶
Parameters¶
usernameThe name of the user that the key pair is associated with.
If
usernameis omitted, the command modifies the key pair for the user who is currently logged in (the active user of this session).MODIFY KEY PAIR key_pair_nameModifies the named key pair.
The names
PUBLIC_KEY_1andPUBLIC_KEY_2are reserved for keys assigned with the legacyRSA_PUBLIC_KEYandRSA_PUBLIC_KEY_2user properties and can’t be modified through this command. Use ALTER USER to update those legacy keys.RENAME TO new_key_pair_nameSpecifies a new name for the key pair. The names
PUBLIC_KEY_1andPUBLIC_KEY_2are reserved for keys assigned with the legacyRSA_PUBLIC_KEYandRSA_PUBLIC_KEY_2user properties (see ALTER USER) and can’t be used as a new name.SET ...Specifies one or more properties to set for the key pair (separated by blank spaces, commas, or new lines):
DISABLED = { TRUE | FALSE }Disables or enables the key pair. A disabled key pair cannot be used to authenticate, but its metadata is retained and it can later be re-enabled by setting DISABLED to FALSE.
COMMENT = '<string_literal>'Specifies a comment for the key pair.
UNSET ...Unsets one or more properties for the key pair, which resets the properties to their defaults:
DISABLEDCOMMENT
To unset multiple properties or parameters with a single ALTER statement, separate each property or parameter with a comma.
When unsetting a property or parameter, specify only the property or parameter name (unless the syntax above indicates that you should specify the value). Specifying the value returns an error.
Access control requirements¶
A role used to execute this operation must have the following privileges at a minimum:
| Privilege | Object | Notes |
|---|---|---|
| MODIFY PROGRAMMATIC AUTHENTICATION METHODS | User | Required to modify a key pair. |
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶
- You can’t change the public key, role restriction, or expiration time with MODIFY KEY PAIR. To change the public key, use ALTER USER … ROTATE KEY PAIR. To change any other property, remove the key pair and create a new one.
Examples¶
Rename a key pair associated with the user example_user:
Disable a key pair so that it can no longer be used for authentication:
Change the comment associated with a key pair: