Updated on 2025-09-04 GMT+08:00

Querying Database Users

Function

This API is used to query database users for a specified DB instance.

Constraints

  • This operation cannot be performed when the DB instance is in any of the following statuses: creating, changing instance class, changing port, or abnormal.

URI

  • URI format

    GET /v3/{project_id}/instances/{instance_id}/db_user/detail?page={page}&limit={limit}

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Definition

    Project ID of a tenant in a region.

    To obtain the value, see Obtaining a Project ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    instance_id

    Yes

    Definition

    Instance ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    page

    Yes

    Definition

    Page number.

    Constraints

    N/A

    Range

    The value starts from 1.

    Default Value

    N/A

    limit

    Yes

    Definition

    Number of records on each page.

    Constraints

    N/A

    Range

    [1, 100]

    Default Value

    N/A

Request

  • Request parameters

    None

Response

  • Normal response
    Table 2 Parameters

    Parameter

    Type

    Description

    users

    Array of objects

    Definition

    Each element in the list indicates a database account.

    For details, see Table 3.

    total_count

    Integer

    Definition

    Indicates the total number of database users.

    Range

    N/A

    Table 3 users element structure description

    Parameter

    Type

    Description

    name

    String

    Definition

    Indicates the account name.

    Range

    N/A

    attributes

    Object

    Definition

    Indicates permission attributes of a user.

    For details, see Table 4.

    memberof

    Array of strings

    Definition

    Indicates default rights of a user.

    Range

    N/A

    Table 4 attributes element structure description

    Parameter

    Type

    Description

    rolsuper

    Boolean

    Definition

    Whether a user has the super user permission.

    Range

    false: The user does not have the super user permission.

    rolinherit

    Boolean

    Definition

    Whether a user automatically inherits permissions of the role that the user belongs to.

    Range

    • true: The user automatically inherits the permissions of the role that the user belongs to.
    • false: The user does not automatically inherit the permissions of the role that the user belongs to.

    rolcreaterole

    Boolean

    Definition

    Whether a user can create other sub-users.

    Range

    • true: The user can create other sub-users.
    • false: The user cannot create other sub-users.

    rolcreatedb

    Boolean

    Definition

    Whether a user can create databases.

    Range

    • true: The user can create databases.
    • false: The user cannot create databases.

    rolcanlogin

    Boolean

    Definition

    Whether a user has the permissions to log in to a database.

    Range

    • true: The user has the permissions to log in to a database.
    • false: The user does not have the permissions to log in to a database.

    rolconnlimit

    Integer

    Definition

    Maximum number of concurrent connections to an instance. The value -1 indicates that there are no limitations on the number of concurrent connections.

    Range

    N/A

    rolreplication

    Boolean

    Definition

    Whether a user is a replication role.

    Range

    • true: The user is a replication role.
    • false: The user is not a replication role.

    rolbypassrls

    Boolean

    Definition

    Whether a user bypasses each row-level security policy.

    Range

    • true: The user bypasses each row-level security policy.
    • false: The user does not bypass each row-level security policy.
  • Example normal response
    {
    "users": [
    {
      "name": "rdsuser",
      "attributes": {
        "rolsuper": false,
        "rolinherit": true,
        "rolcreaterole": true,
        "rolcreatedb": true,
        "rolcanlogin": true,
        "rolconnlimit": -1,
        "rolreplication": true,
        "rolbypassrls": false
       },
      "memberof": ["pg_monitor", "pg_read_all_stats", "pg_stat_scan_tables", "pg_signal_backend"]
    }, 
    {
      "name": "rdsuser1",
      "attributes": {
        "rolsuper": false,
        "rolinherit": true,
        "rolcreaterole": true,
        "rolcreatedb": true,
        "rolcanlogin": true,
        "rolconnlimit": -1,
        "rolreplication": true,
        "rolbypassrls": false
    },
      "memberof": []
    }],
    "total_count": 2
    }

Status Code

Error Code

For details, see Error Codes.