> 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/the-sql-language/functions/functions-info/functions-info-object.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# 9.27.5. 物件資訊與定址函式

## 9.27.5. 物件資訊與定址函式 [#](#functions-info-object) <a href="#functions-info-object" id="functions-info-object"></a>

[表 9.81](#functions-info-object-table) 列出了與資料庫物件識別及定址相關的函式。

### 表 9.81. 物件資訊與定址函式 [#](#functions-info-object-table) <a href="#functions-info-object-table" id="functions-info-object-table"></a>

| <p>函式</p><p>說明</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>pg\_get\_acl</code> ( <em><code>classid</code></em> <code>oid</code>, <em><code>objid</code></em> <code>oid</code>, <em><code>objsubid</code></em> <code>integer</code> ) → <code>aclitem\[]</code></p><p>回傳以系統目錄 OID、物件 OID 與子物件 ID 指定之資料庫物件的 ACL。對於未定義的物件，這個函式會回傳 <code>NULL</code> 值。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| <p><code>pg\_describe\_object</code> ( <em><code>classid</code></em> <code>oid</code>, <em><code>objid</code></em> <code>oid</code>, <em><code>objsubid</code></em> <code>integer</code> ) → <code>text</code></p><p>回傳以系統目錄 OID、物件 OID 與子物件 ID（例如資料表中的欄位編號；指的是整個物件時，子物件 ID 為零）所識別之資料庫物件的文字描述。這個描述旨在供人閱讀，並且可能會依伺服器的設定而經過翻譯。這特別有助於確認 <code>pg\_depend</code> 系統目錄中所參照之物件的身分。對於未定義的物件，這個函式會回傳 <code>NULL</code> 值。</p>                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>pg\_identify\_object</code> ( <em><code>classid</code></em> <code>oid</code>, <em><code>objid</code></em> <code>oid</code>, <em><code>objsubid</code></em> <code>integer</code> ) → <code>record</code> ( <em><code>type</code></em> <code>text</code>, <em><code>schema</code></em> <code>text</code>, <em><code>name</code></em> <code>text</code>, <em><code>identity</code></em> <code>text</code> )</p><p>回傳一筆資料列，其中包含足以唯一識別以系統目錄 OID、物件 OID 與子物件 ID 所指定之資料庫物件的資訊。這些資訊是供機器讀取的，永遠不會被翻譯。<em><code>type</code></em> 識別資料庫物件的類型；<em><code>schema</code></em> 是該物件所屬的綱要名稱，對於不屬於綱要的物件類型則為 <code>NULL</code>；<em><code>name</code></em> 是物件的名稱（必要時會加上引號），前提是該名稱（在適用時連同綱要名稱）足以唯一識別該物件，否則為 <code>NULL</code>；<em><code>identity</code></em> 是完整的物件識別，其精確格式取決於物件類型，且格式中的每個名稱都會視需要加上綱要限定與引號。未定義的物件會以 <code>NULL</code> 值識別。</p> |
| <p><code>pg\_identify\_object\_as\_address</code> ( <em><code>classid</code></em> <code>oid</code>, <em><code>objid</code></em> <code>oid</code>, <em><code>objsubid</code></em> <code>integer</code> ) → <code>record</code> ( <em><code>type</code></em> <code>text</code>, <em><code>object\_names</code></em> <code>text\[]</code>, <em><code>object\_args</code></em> <code>text\[]</code> )</p><p>回傳一筆資料列，其中包含足以唯一識別以系統目錄 OID、物件 OID 與子物件 ID 所指定之資料庫物件的資訊。所回傳的資訊與目前的伺服器無關，也就是說，它可以用來識別另一台伺服器中同名的物件。<em><code>type</code></em> 識別資料庫物件的類型；<em><code>object\_names</code></em> 與 <em><code>object\_args</code></em> 是文字陣列，兩者共同構成對該物件的參照。這三個值可以傳給 <code>pg\_get\_object\_address</code>，以取得該物件的內部位址。</p>                                                                                                                        |
| <p><code>pg\_get\_object\_address</code> ( <em><code>type</code></em> <code>text</code>, <em><code>object\_names</code></em> <code>text\[]</code>, <em><code>object\_args</code></em> <code>text\[]</code> ) → <code>record</code> ( <em><code>classid</code></em> <code>oid</code>, <em><code>objid</code></em> <code>oid</code>, <em><code>objsubid</code></em> <code>integer</code> )</p><p>回傳一筆資料列，其中包含足以唯一識別以類型代碼、物件名稱與引數陣列所指定之資料庫物件的資訊。所回傳的值就是像 <code>pg\_depend</code> 這類系統目錄中會使用的值；它們可以傳給其他系統函式，例如 <code>pg\_describe\_object</code> 或 <code>pg\_identify\_object</code>。<em><code>classid</code></em> 是包含該物件之系統目錄的 OID；<em><code>objid</code></em> 是物件本身的 OID，而 <em><code>objsubid</code></em> 是子物件 ID，若無則為零。這個函式是 <code>pg\_identify\_object\_as\_address</code> 的反函式。未定義的物件會以 <code>NULL</code> 值識別。</p>                |

<br>

`pg_get_acl` 可用於擷取並檢視與資料庫物件相關聯的權限，而不必去查看特定的系統目錄。例如，要擷取目前資料庫中所有物件上已授予的權限：

```

postgres=# SELECT
    (pg_identify_object(s.classid,s.objid,s.objsubid)).*,
    pg_catalog.pg_get_acl(s.classid,s.objid,s.objsubid) AS acl
FROM pg_catalog.pg_shdepend AS s
JOIN pg_catalog.pg_database AS d
    ON d.datname = current_database() AND
       d.oid = s.dbid
JOIN pg_catalog.pg_authid AS a
    ON a.oid = s.refobjid AND
       s.refclassid = 'pg_authid'::regclass
WHERE s.deptype = 'a';
-[ RECORD 1 ]-----------------------------------------
type     | table
schema   | public
name     | testtab
identity | public.testtab
acl      | {postgres=arwdDxtm/postgres,foo=r/postgres}
```

[返回 9.27. 系統資訊函式與運算子](https://docs.postgresql.tw/19/the-sql-language/functions/functions-info.md#functions-info)

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/functions-info.html)（原文版本：18.6；核對日期：2026-09-11）


---

# 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/the-sql-language/functions/functions-info/functions-info-object.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.
