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

# 52.12. pg\_collation \#

### 52.12. `pg_collation` [#](#catalog-pg-collation) <a href="#catalog-pg-collation" id="catalog-pg-collation"></a>

目錄 `pg_collation` 描述可用的定序；定序本質上是從 SQL 名稱到作業系統區域設定類別的對應。 更多資訊請參閱[第 23.2 節](https://docs.postgresql.tw/19/server-administration/charset/collation.md)。

#### 表 52.12. `pg_collation` 欄位 [#](#catalog-pg-collation-columns) <a href="#catalog-pg-collation-columns" id="catalog-pg-collation-columns"></a>

| <p>欄位類型</p><p>說明</p>                                                                                                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>oid</code> <code>oid</code></p><p>資料列識別碼</p>                                                                                                                                                            |
| <p><code>collname</code> <code>name</code></p><p>定序名稱（在每個命名空間與編碼中唯一）</p>                                                                                                                                         |
| <p><code>collnamespace</code> <code>oid</code> （參照 <a href="https://docs.postgresql.tw/19/internals/catalogs/catalog-pg-namespace.md"><code>pg\_namespace</code></a>.<code>oid</code>）</p><p>包含此定序之命名空間的 OID</p> |
| <p><code>collowner</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>collprovider</code> <code>char</code></p><p>定序的提供者：<code>d</code> = 資料庫預設， <code>b</code> = 內建（builtin），<code>c</code> = libc， <code>i</code> = icu</p>                                                 |
| <p><code>collisdeterministic</code> <code>bool</code></p><p>此定序是否為確定性定序？</p>                                                                                                                                     |
| <p><code>collencoding</code> <code>int4</code></p><p>此定序適用的編碼；若適用於任何編碼則為 -1</p>                                                                                                                                  |
| <p><code>collcollate</code> <code>text</code></p><p>此定序物件的 <code>LC\_COLLATE</code>。若提供者不是 <code>libc</code>，則 <code>collcollate</code> 為 <code>NULL</code>，改用 <code>colllocale</code>。</p>                      |
| <p><code>collctype</code> <code>text</code></p><p>此定序物件的 <code>LC\_CTYPE</code>。若提供者不是 <code>libc</code>，則 <code>collctype</code> 為 <code>NULL</code>，改用 <code>colllocale</code>。</p>                            |
| <p><code>colllocale</code> <code>text</code></p><p>此定序物件的定序提供者區域設定名稱。若提供者是 <code>libc</code>，則 <code>colllocale</code> 為 <code>NULL</code>； 改用 <code>collcollate</code> 與 <code>collctype</code>。</p>            |
| <p><code>collicurules</code> <code>text</code></p><p>此定序物件的 ICU 定序規則</p>                                                                                                                                         |
| <p><code>collversion</code> <code>text</code></p><p>定序的提供者特定版本。此值在建立定序時記錄，並在使用定序時檢查， 以偵測可能導致資料損毀的定序定義變更。</p>                                                                                                     |

<br>

請注意，此目錄上的唯一鍵是（`collname`, `collencoding`, `collnamespace`），而不只是 （`collname`, `collnamespace`）。 PostgreSQL 通常會忽略所有 `collencoding` 既不等於目前資料庫的編碼、 也不等於 -1 的定序，而且禁止建立與某個 `collencoding` = -1 的項目同名的新項目。 因此，使用限定的 SQL 名稱 （*`schema`*.*`name`*）就足以識別一個定序， 即使依目錄定義這並不唯一。 如此定義此目錄的原因是： initdb 會在叢集初始化時，以系統上所有可用區域設定的 項目填入此目錄，因此它必須能夠容納叢集中可能使用的 所有編碼的項目。

在 `template0` 資料庫中，建立編碼與資料庫編碼不相符的定序 可能會有用處，因為這些定序可能與日後從 `template0` 複製出的資料庫編碼相符。目前這必須以手動方式完成。

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/catalog-pg-collation.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-collation.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.
