uuid-ossp
generate universally unique identifiers (UUIDs)
uuid-ossp : generate universally unique identifiers (UUIDs)
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4930 | uuid-ossp | uuid-ossp | 1.1 |
FUNC | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-dt- | No | Yes | No | Yes | no | yes |
Packages
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
| 1.1 | 1.1 | 1.1 | 1.1 | 1.1 |
This is a built-in contrib extension ship with the PostgreSQL kernel
Install
Create this extension with:
Usage
Provides functions to generate UUIDs using several standard algorithms. Note: for simple random UUIDs, consider using the built-in gen_random_uuid() instead.
UUID Generation Functions
| Function | Description |
|---|---|
uuid_generate_v1() |
Version 1: MAC address + timestamp |
uuid_generate_v1mc() |
Version 1 with random multicast MAC |
uuid_generate_v3(namespace uuid, name text) |
Version 3: MD5 hash of namespace + name |
uuid_generate_v4() |
Version 4: fully random |
uuid_generate_v5(namespace uuid, name text) |
Version 5: SHA-1 hash of namespace + name (preferred over v3) |
Namespace Constants
| Function | Description |
|---|---|
uuid_nil() |
Nil UUID (all zeros) |
uuid_ns_dns() |
DNS namespace |
uuid_ns_url() |
URL namespace |
uuid_ns_oid() |
ISO OID namespace |
uuid_ns_x500() |
X.500 DN namespace |