Top
Enterprise Postgres 16 Operation Guide

B.3.1 Profile Management Functions

Name

Return type

Description

pgx_create_profile(profile_name name, password_parameter json)

void

Create a new profile.

For profile_name, specify the profile name. An error will occur if an existing profile name is specified.

For password_parameter, specify parameters and values in key-value format as follows.

'{
    "PASSWORD_LIFE_TIME": 30,
    "PASSWORD_GRACE_TIME": "UNLIMITED",
    "PASSWORD_REUSE_TIME": 10,
    "PASSWORD_REUSE_MAX": 5,
    "PASSWORD_LOCK_TIME": 0.5,
    "FAILED_LOGIN_ATTEMPTS": "DEFAULT",
    "PASSWORD_ALLOW_HASHED": true
}');

The json value accepts integer, numeric, boolean depending on the parameter, but only accepts strings "DEFAULT" and "UNLIMITED" as special values.

For parameters that are omitted in json or that specify null for value, they follow the values in the default profile.Also, password_parameter can be omitted, and if omitted, a profile with all parameters conforming to the default profile will be created.

pgx_alter_profile(profile_name name, alter_parameter json)

void

Update the contents of an existing profile.

For profile_name, specify the name of the profile to update. If you specify a profile name that does not exist, an error will occur.

In alter_parameter, specify the variable name and value you want to change in key-value format as follows. Does not change the profile contents for parameters that are omitted or for which value is null.

'{
    "name": "new_name",
    "PASSWORD_LIFE_TIME": 50,
    "PASSWORD_GRACE_TIME": 10
}');

name: Specify the modified profile name. null cannot be specified.

If the default profile is specified in profile_name, the following changes cannot be made.

  • Change name

  • Change each password_parameter to "DEFAULT"

pgx_drop_profile(profile_name name, if_exists boolean, cascade boolean)

void

Delete an existing profile.

Specify the profile name to be deleted in profile_name.

Specifying the default profile will result in an error.

if_exists specifies whether an error occurs when a nonexistent profile name is specified in profile_name. If true, no error. if_exists is optional. Default value is false.

cascade specifies whether an error occurs when a profile assigned to a user is specified in profile_name. If false, an error will occur. If true, unassign all of the profiles before deleting them, and any unassigned users will be assigned the default profile instead. cascade is optional. Default value is false.

[Example when specifying true]
Specify arguments explicitly. (Example of named notation)

SELECT pgx_drop_profile('test_profile', cascade => true);