# 9.14. UUID Functions

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

```
gen_random_uuid () → uuid
```

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

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

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


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
