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

# 9.28.1. 組態設定函式

## 9.28.1. 組態設定函式 [#](#functions-admin-set) <a href="#functions-admin-set" id="functions-admin-set"></a>

[表 9.95](#functions-admin-set-table) 列出可用來查詢與修改執行時期組態參數的函式。

### 表 9.95. 組態設定函式 [#](#functions-admin-set-table) <a href="#functions-admin-set-table" id="functions-admin-set-table"></a>

| <p>函式</p><p>說明</p><p>範例</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>current\_setting</code> ( <em><code>setting\_name</code></em> <code>text</code> \[, <em><code>missing\_ok</code></em> <code>boolean</code> ] ) → <code>text</code></p><p>回傳設定 <em><code>setting\_name</code></em> 目前的值。如果沒有這個設定，<code>current\_setting</code> 會拋出錯誤，除非有提供 <em><code>missing\_ok</code></em> 且其值為 <code>true</code>（此時會回傳 NULL）。這個函式對應於 SQL 指令 <a href="https://docs.postgresql.tw/19/reference/sql-commands/sql-show.md">SHOW</a>。</p><p><code>current\_setting('datestyle')</code> → <code>ISO, MDY</code></p>                                                                                                                                                                                                        |
| <p><code>set\_config</code> ( <em><code>setting\_name</code></em> <code>text</code>, <em><code>new\_value</code></em> <code>text</code>, <em><code>is\_local</code></em> <code>boolean</code> ) → <code>text</code></p><p>將參數 <em><code>setting\_name</code></em> 設定為 <em><code>new\_value</code></em>，並回傳該值。如果 <em><code>is\_local</code></em> 為 <code>true</code>，新值只會在目前的交易期間生效。如果你希望新值在目前工作階段的其餘時間都生效，請改用 <code>false</code>。這個函式對應於 SQL 指令 <a href="https://docs.postgresql.tw/19/reference/sql-commands/sql-set.md">SET</a>。</p><p><code>set\_config</code> 接受以 NULL 值作為 <em><code>new\_value</code></em>，但由於設定不能為 NULL，這會被解讀為將該設定重設為預設值的請求。</p><p><code>set\_config('log\_statement\_stats', 'off', false)</code> → <code>off</code></p> |

<br>

[返回 9.28. 系統管理函式](https://docs.postgresql.tw/19/the-sql-language/functions/functions-admin.md#functions-admin)

***

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