The uuid-ossp extension provides functions to generate universally unique identifiers (UUIDs) using one of several standard algorithms. It is useful for creating unique primary keys that are unique across distributed systems. For more information, see the official PostgreSQL uuid-ossp Documentation.Documentation Index
Fetch the complete documentation index at: https://docs-relytone.data.cloud/llms.txt
Use this file to discover all available pages before exploring further.
Quick Start
Step 1: Enable Extension
Enable the extension in your database:Step 2: Generate UUIDs
Generate a random Version 4 UUID (most common):Step 3: Use as Primary Key
Create a table using UUID as the primary key with a default value:Functions
| Function | Return Type | Description |
|---|---|---|
uuid_generate_v1() | uuid | Generates a version 1 UUID using MAC address and timestamp. |
uuid_generate_v1mc() | uuid | Generates a version 1 UUID using a random multicast MAC address. |
uuid_generate_v3(namespace, name) | uuid | Generates a deterministic version 3 UUID (MD5) from namespace and name. |
uuid_generate_v4() | uuid | Generates a random version 4 UUID. |
uuid_generate_v5(namespace, name) | uuid | Generates a deterministic version 5 UUID (SHA-1) from namespace and name. Preferred over v3. |