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

# LOAD

### LOAD

LOAD — 載入共享函式庫檔案

### 語法

```

LOAD 'filename'
```

### 說明

此指令會將共享函式庫檔案載入 PostgreSQL 伺服器的位址空間。若該檔案已經載入過，此指令則不做任何事。包含 C 函式的共享函式庫檔案，會在其中任一函式被呼叫時自動載入。因此，通常只有在要載入透過「掛鉤（hook）」而非提供一組函式來修改伺服器行為的函式庫時，才需要明確使用 `LOAD`。

函式庫檔案名稱通常只需給定一個單純的檔案名稱，系統會在伺服器的函式庫搜尋路徑（由 [dynamic\_library\_path](https://docs.postgresql.tw/19/server-administration/runtime-config/runtime-config-client.md#GUC-DYNAMIC-LIBRARY-PATH) 設定）中尋找。也可以改為給定完整路徑名稱。無論哪種方式，都可以省略該平台標準的共享函式庫檔案副檔名。關於此主題的更多資訊，請參閱[第 36.10.1 節](https://docs.postgresql.tw/19/server-programming/extend/xfunc-c.md#xfunc-c-dynload)。

非超級使用者只能對位於 `$libdir/plugins/` 的函式庫檔案套用 `LOAD` — 所指定的 *`filename`* 必須恰好以此字串開頭。（確保該處只安裝「安全」的函式庫，是資料庫管理員的責任。）

### 相容性

`LOAD` 是 PostgreSQL 的擴充功能。

### 另請參閱

[CREATE FUNCTION](https://docs.postgresql.tw/19/reference/sql-commands/sql-createfunction.md)

***

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


---

# 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/reference/sql-commands/sql-load.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.
