select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / UUID FUNCTIONS

uuid_extract_version

Read PG 18 manual ↗

Extracts the version from a UUID of one of the variants described by RFC 9562.

Signatures & examples

uuid_extract_version ( uuid ) → smallint
Extracts the version from a UUID of one of the variants described by RFC 9562. For other variants, this function returns null. For example, for a UUID generated by gen_random_uuid(), this function will return 4.
uuid_extract_version('41db1265-8bc1-4ab3-992f-​885799a4af1d'::uuid) → 4
uuid_extract_version('019535d9-3df7-79fb-b466-​fa907fa17f9e'::uuid) → 7
Version history 2
  1. PG 17 → 18changed
  2. PG 16 → 17added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source