> 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/14/the-sql-language/functions-and-operators/uuid-functions.md).

# 9.14. UUID Functions

PostgreSQL 提供了一個產成 UUID 的函數：

```
gen_random_uuid () → uuid
```

此函數回傳版本 4（隨機）的 UUID。這是最常用的 UUID 樣式，適用於大多數的應用。

[uuid-ossp](/14/appendixes/additional-supplied-modules/uuid-ossp.md) 模組提供了其他函數，這些函數實作了用於產生成其他 UUID 的標準演算法。

PostgreSQL 還提供了 [Table 9.1](/14/the-sql-language/functions-and-operators/comparison-functions-and-operators.md#table-9-1-comparison-operators) 中列出的用於 UUID 常用的比較運算子。


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.postgresql.tw/14/the-sql-language/functions-and-operators/uuid-functions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
