Skip to main content
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.

Quick Start

Step 1: Enable Extension

Enable the extension in your database:

Step 2: Generate UUIDs

Generate a random Version 4 UUID (most common):
Expected Output:
Generate a Version 1 UUID (timestamp & MAC address):

Step 3: Use as Primary Key

Create a table using UUID as the primary key with a default value:

Functions