> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/19/internals/views/view-pg-user-mappings.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# 53.36. pg\_user\_mappings \#

### 53.36. `pg_user_mappings` [#](#view-pg-user-mappings) <a href="#view-pg-user-mappings" id="view-pg-user-mappings"></a>

檢視表 `pg_user_mappings` 提供對使用者對應資訊的存取。它基本上是 [`pg_user_mapping`](https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-user-mapping.md) 的一個可公開讀取的檢視表，在使用者無權使用選項欄位時會略去該欄位。

#### 表 53.36. `pg_user_mappings` 欄位 [#](#view-pg-user-mappings-columns) <a href="#view-pg-user-mappings-columns" id="view-pg-user-mappings-columns"></a>

| <p>欄位類型</p><p>說明</p>                                                                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>umid</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-user-mapping.md"><code>pg\_user\_mapping</code></a>.<code>oid</code>）</p><p>使用者對應的 OID</p>               |
| <p><code>srvid</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-foreign-server.md"><code>pg\_foreign\_server</code></a>.<code>oid</code>）</p><p>包含此對應之外部伺服器的 OID</p>    |
| <p><code>srvname</code> <code>name</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-foreign-server.md"><code>pg\_foreign\_server</code></a>.<code>srvname</code>）</p><p>外部伺服器名稱</p>      |
| <p><code>umuser</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-authid.md"><code>pg\_authid</code></a>.<code>oid</code>）</p><p>被對應之本地角色的 OID；若此使用者對應為公用（public）則為零</p> |
| <p><code>usename</code> <code>name</code></p><p>要被對應之本地使用者的名稱</p>                                                                                                                                                       |
| <p><code>umoptions</code> <code>text\[]</code></p><p>使用者對應專屬的選項，以 “keyword=value” 字串形式呈現</p>                                                                                                                            |

<br>

為了保護以使用者對應選項形式儲存的密碼資訊，除非符合下列其中一項條件，否則 `umoptions` 欄位讀出的值將為 null：

* 目前使用者就是被對應的使用者，且擁有該伺服器或持有該伺服器的 `USAGE` 權限
* 目前使用者是該伺服器的擁有者，且此對應是針對 `PUBLIC`
* 目前使用者是超級使用者

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/view-pg-user-mappings.html)（原文版本：18.6；核對日期：2026-10-10）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/19/internals/views/view-pg-user-mappings.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
