> 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/18/client-interfaces.md).

# 第四部分：用戶端介面

## 第四部分：用戶端介面

本部分說明隨 PostgreSQL 一起發佈的用戶端程式設計介面。各章都可以獨立閱讀。另外還有許多單獨發佈、供用戶端程式使用的外部程式設計介面，它們各自附有說明文件（[附錄 H](https://docs.postgresql.tw/18/appendixes/external-projects.md) 列出其中幾個較受歡迎的介面）。本部分的讀者應該熟悉如何使用 SQL 操作與查詢資料庫（請參閱[第二部分](https://docs.postgresql.tw/18/the-sql-language.md)），當然也應該熟悉自己所選用的程式語言。

**目錄**

* [32. libpq — C 函式庫](https://docs.postgresql.tw/18/client-interfaces/libpq.md)
  * [32.1. 資料庫連線控制函式](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-connect.md)
  * [32.2. 連線狀態函式](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-status.md)
  * [32.3. 命令執行函式](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-exec.md)
  * [32.4. 非同步命令處理](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-async.md)
  * [32.5. 管線模式](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-pipeline-mode.md)
  * [32.6. 分塊取得查詢結果](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-single-row-mode.md)
  * [32.7. 取消進行中的查詢](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-cancel.md)
  * [32.8. 快速路徑介面](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-fastpath.md)
  * [32.9. 非同步通知](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-notify.md)
  * [32.10. 與 `COPY` 命令相關的函式](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-copy.md)
  * [32.11. 控制函式](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-control.md)
  * [32.12. 其他函式](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-misc.md)
  * [32.13. 通知訊息處理](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-notice-processing.md)
  * [32.14. 事件系統](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-events.md)
  * [32.15. 環境變數](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-envars.md)
  * [32.16. 密碼檔](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-pgpass.md)
  * [32.17. 連線服務檔](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-pgservice.md)
  * [32.18. 以 LDAP 查詢連線參數](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-ldap.md)
  * [32.19. SSL 支援](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-ssl.md)
  * [32.20. OAuth 支援](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-oauth.md)
  * [32.21. 多執行緒程式中的行為](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-threading.md)
  * [32.22. 建置 libpq 程式](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-build.md)
  * [32.23. 範例程式](https://docs.postgresql.tw/18/client-interfaces/libpq/libpq-example.md)
* [33. 大型物件](https://docs.postgresql.tw/18/client-interfaces/largeobjects.md)
  * [33.1. 簡介](https://docs.postgresql.tw/18/client-interfaces/largeobjects/lo-intro.md)
  * [33.2. 實作特性](https://docs.postgresql.tw/18/client-interfaces/largeobjects/lo-implementation.md)
  * [33.3. 用戶端介面](https://docs.postgresql.tw/18/client-interfaces/largeobjects/lo-interfaces.md)
  * [33.4. 伺服器端函式](https://docs.postgresql.tw/18/client-interfaces/largeobjects/lo-funcs.md)
  * [33.5. 範例程式](https://docs.postgresql.tw/18/client-interfaces/largeobjects/lo-examplesect.md)
* [34. ECPG — C 語言中的嵌入式 SQL](https://docs.postgresql.tw/18/client-interfaces/ecpg.md)
  * [34.1. 概念](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-concept.md)
  * [34.2. 管理資料庫連線](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-connect.md)
  * [34.3. 執行 SQL 命令](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-commands.md)
  * [34.4. 使用主機變數](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-variables.md)
  * [34.5. 動態 SQL](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-dynamic.md)
  * [34.6. pgtypes 函式庫](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-pgtypes.md)
  * [34.7. 使用描述區](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-descriptors.md)
  * [34.8. 錯誤處理](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-errors.md)
  * [34.9. 前置處理器指令](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-preproc.md)
  * [34.10. 處理嵌入式 SQL 程式](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-process.md)
  * [34.11. 函式庫函式](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-library.md)
  * [34.12. 大型物件](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-lo.md)
  * [34.13. C++ 應用程式](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-cpp.md)
  * [34.14. 嵌入式 SQL 命令](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-sql-commands.md)
  * [34.15. Informix 相容模式](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-informix-compat.md)
  * [34.16. Oracle 相容模式](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-oracle-compat.md)
  * [34.17. 內部運作](https://docs.postgresql.tw/18/client-interfaces/ecpg/ecpg-develop.md)
* [35. 資訊綱要](https://docs.postgresql.tw/18/client-interfaces/information-schema.md)
  * [35.1. 資訊結構描述](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-schema.md)
  * [35.2. 資料型別](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-datatypes.md)
  * [35.3. `information_schema_catalog_name`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-information-schema-catalog-name.md)
  * [35.4. `administrable_role_​authorizations`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-administrable-role-authorizations.md)
  * [35.5. `applicable_roles`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-applicable-roles.md)
  * [35.6. `attributes`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-attributes.md)
  * [35.7. `character_sets`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-character-sets.md)
  * [35.8. `check_constraint_routine_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-check-constraint-routine-usage.md)
  * [35.9. `check_constraints`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-check-constraints.md)
  * [35.10. `collations`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-collations.md)
  * [35.11. `collation_character_set_​applicability`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-collation-character-set-applicab.md)
  * [35.12. `column_column_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-column-column-usage.md)
  * [35.13. `column_domain_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-column-domain-usage.md)
  * [35.14. `column_options`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-column-options.md)
  * [35.15. `column_privileges`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-column-privileges.md)
  * [35.16. `column_udt_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-column-udt-usage.md)
  * [35.17. `columns`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-columns.md)
  * [35.18. `constraint_column_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-constraint-column-usage.md)
  * [35.19. `constraint_table_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-constraint-table-usage.md)
  * [35.20. `data_type_privileges`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-data-type-privileges.md)
  * [35.21. `domain_constraints`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-domain-constraints.md)
  * [35.22. `domain_udt_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-domain-udt-usage.md)
  * [35.23. `domains`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-domains.md)
  * [35.24. `element_types`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-element-types.md)
  * [35.25. `enabled_roles`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-enabled-roles.md)
  * [35.26. `foreign_data_wrapper_options`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-foreign-data-wrapper-options.md)
  * [35.27. `foreign_data_wrappers`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-foreign-data-wrappers.md)
  * [35.28. `foreign_server_options`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-foreign-server-options.md)
  * [35.29. `foreign_servers`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-foreign-servers.md)
  * [35.30. `foreign_table_options`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-foreign-table-options.md)
  * [35.31. `foreign_tables`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-foreign-tables.md)
  * [35.32. `key_column_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-key-column-usage.md)
  * [35.33. `parameters`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-parameters.md)
  * [35.34. `referential_constraints`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-referential-constraints.md)
  * [35.35. `role_column_grants`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-role-column-grants.md)
  * [35.36. `role_routine_grants`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-role-routine-grants.md)
  * [35.37. `role_table_grants`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-role-table-grants.md)
  * [35.38. `role_udt_grants`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-role-udt-grants.md)
  * [35.39. `role_usage_grants`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-role-usage-grants.md)
  * [35.40. `routine_column_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-routine-column-usage.md)
  * [35.41. `routine_privileges`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-routine-privileges.md)
  * [35.42. `routine_routine_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-routine-routine-usage.md)
  * [35.43. `routine_sequence_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-routine-sequence-usage.md)
  * [35.44. `routine_table_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-routine-table-usage.md)
  * [35.45. `routines`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-routines.md)
  * [35.46. `schemata`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-schemata.md)
  * [35.47. `sequences`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-sequences.md)
  * [35.48. `sql_features`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-sql-features.md)
  * [35.49. `sql_implementation_info`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-sql-implementation-info.md)
  * [35.50. `sql_parts`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-sql-parts.md)
  * [35.51. `sql_sizing`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-sql-sizing.md)
  * [35.52. `table_constraints`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-table-constraints.md)
  * [35.53. `table_privileges`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-table-privileges.md)
  * [35.54. `tables`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-tables.md)
  * [35.55. `transforms`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-transforms.md)
  * [35.56. `triggered_update_columns`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-triggered-update-columns.md)
  * [35.57. `triggers`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-triggers.md)
  * [35.58. `udt_privileges`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-udt-privileges.md)
  * [35.59. `usage_privileges`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-usage-privileges.md)
  * [35.60. `user_defined_types`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-user-defined-types.md)
  * [35.61. `user_mapping_options`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-user-mapping-options.md)
  * [35.62. `user_mappings`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-user-mappings.md)
  * [35.63. `view_column_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-view-column-usage.md)
  * [35.64. `view_routine_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-view-routine-usage.md)
  * [35.65. `view_table_usage`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-view-table-usage.md)
  * [35.66. `views`](https://docs.postgresql.tw/18/client-interfaces/information-schema/infoschema-views.md)

***

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


---

# 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/18/client-interfaces.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.
