Skip to content

uuid_bytea

Convert PostgreSQL UUID values to and from 16-byte binary values

uuid_bytea · Convert PostgreSQL UUID values to and from 16-byte binary values

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102127uuid_byteauuid_bytea1.0FUNCC

PostgreSQL · 9.1

Usage

Sources:

uuid_bytea is a small experimental C extension for explicit conversion between uuid and bytea. The upstream author describes it as toy code tested on PostgreSQL 9.1.

Core Workflow

CREATE EXTENSION uuid_bytea;
SELECT uuid_to_bytea('0fcc6350-118d-11e4-a559-7de5338eb025'::uuid);
SELECT bytea_to_uuid(decode('0fcc6350118d11e4a5597de5338eb025','hex'));

Operational Boundaries

uuid_to_bytea returns the UUID’s 16 bytes; bytea_to_uuid converts a 16-byte value back. Explicit casts are also installed. Do not supply arbitrary-length binary values or assume that UUID textual byte order describes an external protocol.

Installation requires a superuser. No preload is specified. The historical test environment does not establish current compatibility, and the reviewed directory provides no license declaration.

Table reader