> 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/catalogs/catalog-pg-subscription.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# 52.54. pg\_subscription \#

### 52.54. `pg_subscription` [#](#catalog-pg-subscription) <a href="#catalog-pg-subscription" id="catalog-pg-subscription"></a>

目錄 `pg_subscription` 包含所有現有的邏輯複寫訂閱。關於邏輯複寫的更多資訊，請參閱[第 29 章](https://docs.postgresql.tw/19/server-administration/logical-replication.md)。

與大多數系統目錄不同，`pg_subscription` 由叢集中的所有資料庫共用：每個叢集只有一份 `pg_subscription`，而不是每個資料庫各一份。

一般使用者對欄位 `subconninfo` 的存取權已被撤銷，因為其中可能包含明文密碼。

#### 表 52.54. `pg_subscription` 欄位 [#](#catalog-pg-subscription-columns) <a href="#catalog-pg-subscription-columns" id="catalog-pg-subscription-columns"></a>

| <p>欄位類型</p><p>說明</p>                                                                                                                                                                                                                          |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>oid</code> <code>oid</code></p><p>資料列識別碼</p>                                                                                                                                                                                         |
| <p><code>subdbid</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-database.md"><code>pg\_database</code></a>.<code>oid</code>）</p><p>訂閱所在資料庫的 OID</p>                                         |
| <p><code>subskiplsn</code> <code>pg\_lsn</code></p><p>若為有效的 LSN，則為其變更將被略過之交易的結束 LSN； 否則為 <code>0/0</code>。</p>                                                                                                                                |
| <p><code>subname</code> <code>name</code></p><p>訂閱的名稱</p>                                                                                                                                                                                     |
| <p><code>subowner</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>訂閱的擁有者</p>                                                  |
| <p><code>subenabled</code> <code>bool</code></p><p>若為真，表示訂閱已啟用，且應該正在進行複寫</p>                                                                                                                                                                  |
| <p><code>subbinary</code> <code>bool</code></p><p>若為真，訂閱會要求發佈者以二進位格式傳送資料</p>                                                                                                                                                                  |
| <p><code>substream</code> <code>char</code></p><p>控制如何處理進行中交易的串流： <code>f</code> = 不允許串流進行中的交易， <code>t</code> = 將進行中交易的變更寫出到磁碟， 待交易在發佈者端提交並由訂閱者接收後再一次套用， <code>p</code> = 若有可用的平行套用工作程序，則直接使用它套用變更 （若沒有可用的工作程序，則與 <code>t</code> 相同）</p>     |
| <p><code>subtwophasestate</code> <code>char</code></p><p>兩階段模式的狀態代碼： <code>d</code> = 已停用， <code>p</code> = 等待啟用， <code>e</code> = 已啟用</p>                                                                                                    |
| <p><code>subdisableonerr</code> <code>bool</code></p><p>若為真，當訂閱的某個工作程序偵測到錯誤時，訂閱將被停用</p>                                                                                                                                                       |
| <p><code>subpasswordrequired</code> <code>bool</code></p><p>若為真，訂閱將被要求指定密碼以進行身分驗證</p>                                                                                                                                                         |
| <p><code>subrunasowner</code> <code>bool</code></p><p>若為真，訂閱將以訂閱擁有者的權限執行</p>                                                                                                                                                                  |
| <p><code>subfailover</code> <code>bool</code></p><p>若為真，上游資料庫中相關聯的複寫插槽（即主插槽與資料表同步插槽） 已啟用為可同步至備用伺服器</p>                                                                                                                                        |
| <p><code>subconninfo</code> <code>text</code></p><p>連線至上游資料庫的連線字串</p>                                                                                                                                                                         |
| <p><code>subslotname</code> <code>name</code></p><p>上游資料庫中複寫插槽的名稱（也用作本地端複寫來源的名稱）； null 代表 <code>NONE</code></p>                                                                                                                               |
| <p><code>subsynccommit</code> <code>text</code></p><p>訂閱的工作程序所使用的 <code>synchronous\_commit</code> 設定</p>                                                                                                                                     |
| <p><code>subpublications</code> <code>text\[]</code></p><p>所訂閱之發佈的名稱陣列。這些名稱參照上游資料庫中定義的發佈。 關於發佈的更多資訊，請參閱<a href="https://docs.postgresql.tw/19/server-administration/logical-replication/logical-replication-publication.md">第 29.1 節</a>。</p> |
| <p><code>suborigin</code> <code>text</code></p><p>來源（origin）值必須是 <code>none</code> 或 <code>any</code>。預設為 <code>any</code>。 若為 <code>none</code>，訂閱會要求發佈者 只傳送沒有來源的變更。若為 <code>any</code>，發佈者無論變更的來源為何都會傳送。</p>                                |

<br>

***

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


---

# 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/catalogs/catalog-pg-subscription.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.
