<commit_before># 51.81 pg\_roles

The view `pg_roles` provides access to information about database roles. This is simply a publicly readable view of [`pg_authid`](https://www.postgresql.org/docs/10/static/catalog-pg-authid.html) that blanks out the password field.

This view explicitly exposes the OID column of the underlying table, since that is needed to do joins to other catalogs.

**Table 51.82. `pg_roles` Columns**

| Name | Type | References | Description |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `rolname` | `name` |   | Role name |
| `rolsuper` | `bool` |   | Role has superuser privileges |
| `rolinherit` | `bool` |   | Role automatically inherits privileges of roles it is a member of |
| `rolcreaterole` | `bool` |   | Role can create more roles |
| `rolcreatedb` | `bool` |   | Role can create databases |
| `rolcanlogin` | `bool` |   | Role can log in. That is, this role can be given as the initial session authorization identifier |
| `rolreplication` | `bool` |   | Role is a replication role. A replication role can initiate replication connections and create and drop replication slots. |
| `rolconnlimit` | `int4` |   | For roles that can log in, this sets maximum number of concurrent connections this role can make. -1 means no limit. |
| `rolpassword` | `text` |   | Not the password \(always reads as `********`\) |
| `rolvaliduntil` | `timestamptz` |   | Password expiry time \(only used for password authentication\); null if no expiration |
| `rolbypassrls` | `bool` |   | Role bypasses every row level security policy, see [Section 5.7](https://www.postgresql.org/docs/10/static/ddl-rowsecurity.html) for more information. |
| `rolconfig` | `text[]` |   | Role-specific defaults for run-time configuration variables |
| `oid` | `oid` | [`pg_authid`](https://www.postgresql.org/docs/10/static/catalog-pg-authid.html).oid | ID of role |<commit_msg>GitBook: [master] one page modified<commit_after># 51.81 pg\_roles

pg\_roles 這個 view 提供對資料庫角色的資訊。 這只是 pg\_authid 的一個公共可讀的 view，它將密碼部份予以屏蔽。

此 view 列出底層的 OID 欄位，因此可能需要執行與其他目錄的交叉查詢。

**Table 51.82. `pg_roles` 欄位**

| Name | Type | References | Description |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `rolname` | `name` |   | 角色名稱 |
| `rolsuper` | `bool` |   | 角色具有超級使用者權限 |
| `rolinherit` | `bool` |   | 角色自動繼承它所屬角色的權限 |
| `rolcreaterole` | `bool` |   | 角色可以建立更多角色 |
| `rolcreatedb` | `bool` |   | 角色可以建立資料庫 |
| `rolcanlogin` | `bool` |   | 角色可以登入。也就是說，可以將此角色作為初始連線認證使用 |
| `rolreplication` | `bool` |   | 角色是可以進行資料複寫的角色。複寫角色表示可以啟動資料複寫連線並建立和刪除複寫對象。 |
| `rolconnlimit` | `int4` |   | 對於可以登入的角色，這個設定此角色可以建立的最大同時連線數。 -1 意味著沒有限制。 |
| `rolpassword` | `text` |   | 不是密碼（讀出來都是\*\*\*\*\*\*\*\*） |
| `rolvaliduntil` | `timestamptz` |   | 密碼到期時間（僅用於密碼驗證）; 如果沒有到期時間，則顯示 null |
| `rolbypassrls` | `bool` |   | 角色繞過每一個資料列層級的安全原則，參閱[第 5.7 節](../../sql/5.-ding-yi-zi-liao-jie-gou/5.7.-zi-liao-lie-an-quan-yuan-ze.md)了解更多訊息。 |
| `rolconfig` | `text[]` |   | 執行環境時用於角色的組態預設值 |
| `oid` | `oid` | [`pg_authid`](https://www.postgresql.org/docs/10/static/catalog-pg-authid.html).oid | 角色的 ID |
{'fraction_non_alphanumeric': 0.18155802861685214, 'fraction_numerical': 0.011128775834658187, 'mean_word_length': 3.3333333333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1550907', 'n_tokens_mistral': 1374, 'n_tokens_neox': 1414, 'n_words': 281}