Skip to content

typeid

Allows to use TypeIDs in Postgres natively

pg_typeid : Allows to use TypeIDs in Postgres natively

Overview

ID Extension Package Version Category License Language
4580 typeid pg_typeid 0.4.1 FUNC MIT Rust
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-- No Yes No Yes no no

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 0.4.1 18 17 16 15 14 pg_typeid -
RPM PIGSTY 0.4.1 18 17 16 15 14 pg_typeid_$v -
DEB PIGSTY 0.4.1 18 17 16 15 14 postgresql-$v-typeid -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
el8.aarch64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
el9.x86_64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
el9.aarch64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
el10.x86_64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
el10.aarch64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
d12.x86_64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
d12.aarch64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
d13.x86_64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
d13.aarch64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
u22.x86_64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
u22.aarch64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
u24.x86_64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
u24.aarch64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
u26.x86_64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
u26.aarch64 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1 PIGSTY 0.4.1
Package Version OS ORG SIZE File URL
pg_typeid_18 0.4.1 el8.x86_64 pigsty 892.3 KiB pg_typeid_18-0.4.1-1PGSTY.el8.x86_64.rpm
pg_typeid_18 0.4.1 el8.aarch64 pigsty 775.5 KiB pg_typeid_18-0.4.1-1PGSTY.el8.aarch64.rpm
pg_typeid_18 0.4.1 el9.x86_64 pigsty 913.4 KiB pg_typeid_18-0.4.1-1PGSTY.el9.x86_64.rpm
pg_typeid_18 0.4.1 el9.aarch64 pigsty 827.7 KiB pg_typeid_18-0.4.1-1PGSTY.el9.aarch64.rpm
pg_typeid_18 0.4.1 el10.x86_64 pigsty 907.3 KiB pg_typeid_18-0.4.1-1PGSTY.el10.x86_64.rpm
pg_typeid_18 0.4.1 el10.aarch64 pigsty 807.4 KiB pg_typeid_18-0.4.1-1PGSTY.el10.aarch64.rpm
postgresql-18-typeid 0.4.1 d12.x86_64 pigsty 741.1 KiB postgresql-18-typeid_0.4.1-1PGSTY~bookworm_amd64.deb
postgresql-18-typeid 0.4.1 d12.aarch64 pigsty 621.0 KiB postgresql-18-typeid_0.4.1-1PGSTY~bookworm_arm64.deb
postgresql-18-typeid 0.4.1 d13.x86_64 pigsty 742.9 KiB postgresql-18-typeid_0.4.1-1PGSTY~trixie_amd64.deb
postgresql-18-typeid 0.4.1 d13.aarch64 pigsty 621.9 KiB postgresql-18-typeid_0.4.1-1PGSTY~trixie_arm64.deb
postgresql-18-typeid 0.4.1 u22.x86_64 pigsty 826.4 KiB postgresql-18-typeid_0.4.1-1PGSTY~jammy_amd64.deb
postgresql-18-typeid 0.4.1 u22.aarch64 pigsty 736.6 KiB postgresql-18-typeid_0.4.1-1PGSTY~jammy_arm64.deb
postgresql-18-typeid 0.4.1 u24.x86_64 pigsty 824.1 KiB postgresql-18-typeid_0.4.1-1PGSTY~noble_amd64.deb
postgresql-18-typeid 0.4.1 u24.aarch64 pigsty 726.1 KiB postgresql-18-typeid_0.4.1-1PGSTY~noble_arm64.deb
postgresql-18-typeid 0.4.1 u26.x86_64 pigsty 815.3 KiB postgresql-18-typeid_0.4.1-1PGSTY~resolute_amd64.deb
postgresql-18-typeid 0.4.1 u26.aarch64 pigsty 725.1 KiB postgresql-18-typeid_0.4.1-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_typeid_17 0.4.1 el8.x86_64 pigsty 889.3 KiB pg_typeid_17-0.4.1-1PGSTY.el8.x86_64.rpm
pg_typeid_17 0.4.1 el8.aarch64 pigsty 771.0 KiB pg_typeid_17-0.4.1-1PGSTY.el8.aarch64.rpm
pg_typeid_17 0.4.1 el9.x86_64 pigsty 906.3 KiB pg_typeid_17-0.4.1-1PGSTY.el9.x86_64.rpm
pg_typeid_17 0.4.1 el9.aarch64 pigsty 825.0 KiB pg_typeid_17-0.4.1-1PGSTY.el9.aarch64.rpm
pg_typeid_17 0.4.1 el10.x86_64 pigsty 910.6 KiB pg_typeid_17-0.4.1-1PGSTY.el10.x86_64.rpm
pg_typeid_17 0.4.1 el10.aarch64 pigsty 806.5 KiB pg_typeid_17-0.4.1-1PGSTY.el10.aarch64.rpm
postgresql-17-typeid 0.4.1 d12.x86_64 pigsty 739.2 KiB postgresql-17-typeid_0.4.1-1PGSTY~bookworm_amd64.deb
postgresql-17-typeid 0.4.1 d12.aarch64 pigsty 620.2 KiB postgresql-17-typeid_0.4.1-1PGSTY~bookworm_arm64.deb
postgresql-17-typeid 0.4.1 d13.x86_64 pigsty 740.5 KiB postgresql-17-typeid_0.4.1-1PGSTY~trixie_amd64.deb
postgresql-17-typeid 0.4.1 d13.aarch64 pigsty 620.2 KiB postgresql-17-typeid_0.4.1-1PGSTY~trixie_arm64.deb
postgresql-17-typeid 0.4.1 u22.x86_64 pigsty 823.9 KiB postgresql-17-typeid_0.4.1-1PGSTY~jammy_amd64.deb
postgresql-17-typeid 0.4.1 u22.aarch64 pigsty 734.9 KiB postgresql-17-typeid_0.4.1-1PGSTY~jammy_arm64.deb
postgresql-17-typeid 0.4.1 u24.x86_64 pigsty 820.5 KiB postgresql-17-typeid_0.4.1-1PGSTY~noble_amd64.deb
postgresql-17-typeid 0.4.1 u24.aarch64 pigsty 723.8 KiB postgresql-17-typeid_0.4.1-1PGSTY~noble_arm64.deb
postgresql-17-typeid 0.4.1 u26.x86_64 pigsty 812.2 KiB postgresql-17-typeid_0.4.1-1PGSTY~resolute_amd64.deb
postgresql-17-typeid 0.4.1 u26.aarch64 pigsty 723.7 KiB postgresql-17-typeid_0.4.1-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_typeid_16 0.4.1 el8.x86_64 pigsty 888.1 KiB pg_typeid_16-0.4.1-1PGSTY.el8.x86_64.rpm
pg_typeid_16 0.4.1 el8.aarch64 pigsty 768.2 KiB pg_typeid_16-0.4.1-1PGSTY.el8.aarch64.rpm
pg_typeid_16 0.4.1 el9.x86_64 pigsty 902.0 KiB pg_typeid_16-0.4.1-1PGSTY.el9.x86_64.rpm
pg_typeid_16 0.4.1 el9.aarch64 pigsty 823.1 KiB pg_typeid_16-0.4.1-1PGSTY.el9.aarch64.rpm
pg_typeid_16 0.4.1 el10.x86_64 pigsty 902.9 KiB pg_typeid_16-0.4.1-1PGSTY.el10.x86_64.rpm
pg_typeid_16 0.4.1 el10.aarch64 pigsty 806.1 KiB pg_typeid_16-0.4.1-1PGSTY.el10.aarch64.rpm
postgresql-16-typeid 0.4.1 d12.x86_64 pigsty 737.8 KiB postgresql-16-typeid_0.4.1-1PGSTY~bookworm_amd64.deb
postgresql-16-typeid 0.4.1 d12.aarch64 pigsty 618.6 KiB postgresql-16-typeid_0.4.1-1PGSTY~bookworm_arm64.deb
postgresql-16-typeid 0.4.1 d13.x86_64 pigsty 739.7 KiB postgresql-16-typeid_0.4.1-1PGSTY~trixie_amd64.deb
postgresql-16-typeid 0.4.1 d13.aarch64 pigsty 618.7 KiB postgresql-16-typeid_0.4.1-1PGSTY~trixie_arm64.deb
postgresql-16-typeid 0.4.1 u22.x86_64 pigsty 824.7 KiB postgresql-16-typeid_0.4.1-1PGSTY~jammy_amd64.deb
postgresql-16-typeid 0.4.1 u22.aarch64 pigsty 733.3 KiB postgresql-16-typeid_0.4.1-1PGSTY~jammy_arm64.deb
postgresql-16-typeid 0.4.1 u24.x86_64 pigsty 812.8 KiB postgresql-16-typeid_0.4.1-1PGSTY~noble_amd64.deb
postgresql-16-typeid 0.4.1 u24.aarch64 pigsty 722.4 KiB postgresql-16-typeid_0.4.1-1PGSTY~noble_arm64.deb
postgresql-16-typeid 0.4.1 u26.x86_64 pigsty 809.4 KiB postgresql-16-typeid_0.4.1-1PGSTY~resolute_amd64.deb
postgresql-16-typeid 0.4.1 u26.aarch64 pigsty 721.2 KiB postgresql-16-typeid_0.4.1-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_typeid_15 0.4.1 el8.x86_64 pigsty 879.8 KiB pg_typeid_15-0.4.1-1PGSTY.el8.x86_64.rpm
pg_typeid_15 0.4.1 el8.aarch64 pigsty 760.6 KiB pg_typeid_15-0.4.1-1PGSTY.el8.aarch64.rpm
pg_typeid_15 0.4.1 el9.x86_64 pigsty 896.1 KiB pg_typeid_15-0.4.1-1PGSTY.el9.x86_64.rpm
pg_typeid_15 0.4.1 el9.aarch64 pigsty 814.0 KiB pg_typeid_15-0.4.1-1PGSTY.el9.aarch64.rpm
pg_typeid_15 0.4.1 el10.x86_64 pigsty 897.0 KiB pg_typeid_15-0.4.1-1PGSTY.el10.x86_64.rpm
pg_typeid_15 0.4.1 el10.aarch64 pigsty 804.2 KiB pg_typeid_15-0.4.1-1PGSTY.el10.aarch64.rpm
postgresql-15-typeid 0.4.1 d12.x86_64 pigsty 734.1 KiB postgresql-15-typeid_0.4.1-1PGSTY~bookworm_amd64.deb
postgresql-15-typeid 0.4.1 d12.aarch64 pigsty 613.9 KiB postgresql-15-typeid_0.4.1-1PGSTY~bookworm_arm64.deb
postgresql-15-typeid 0.4.1 d13.x86_64 pigsty 733.7 KiB postgresql-15-typeid_0.4.1-1PGSTY~trixie_amd64.deb
postgresql-15-typeid 0.4.1 d13.aarch64 pigsty 615.3 KiB postgresql-15-typeid_0.4.1-1PGSTY~trixie_arm64.deb
postgresql-15-typeid 0.4.1 u22.x86_64 pigsty 817.1 KiB postgresql-15-typeid_0.4.1-1PGSTY~jammy_amd64.deb
postgresql-15-typeid 0.4.1 u22.aarch64 pigsty 726.6 KiB postgresql-15-typeid_0.4.1-1PGSTY~jammy_arm64.deb
postgresql-15-typeid 0.4.1 u24.x86_64 pigsty 808.4 KiB postgresql-15-typeid_0.4.1-1PGSTY~noble_amd64.deb
postgresql-15-typeid 0.4.1 u24.aarch64 pigsty 717.2 KiB postgresql-15-typeid_0.4.1-1PGSTY~noble_arm64.deb
postgresql-15-typeid 0.4.1 u26.x86_64 pigsty 804.9 KiB postgresql-15-typeid_0.4.1-1PGSTY~resolute_amd64.deb
postgresql-15-typeid 0.4.1 u26.aarch64 pigsty 715.7 KiB postgresql-15-typeid_0.4.1-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_typeid_14 0.4.1 el8.x86_64 pigsty 875.3 KiB pg_typeid_14-0.4.1-1PGSTY.el8.x86_64.rpm
pg_typeid_14 0.4.1 el8.aarch64 pigsty 759.1 KiB pg_typeid_14-0.4.1-1PGSTY.el8.aarch64.rpm
pg_typeid_14 0.4.1 el9.x86_64 pigsty 891.9 KiB pg_typeid_14-0.4.1-1PGSTY.el9.x86_64.rpm
pg_typeid_14 0.4.1 el9.aarch64 pigsty 812.4 KiB pg_typeid_14-0.4.1-1PGSTY.el9.aarch64.rpm
pg_typeid_14 0.4.1 el10.x86_64 pigsty 893.2 KiB pg_typeid_14-0.4.1-1PGSTY.el10.x86_64.rpm
pg_typeid_14 0.4.1 el10.aarch64 pigsty 801.4 KiB pg_typeid_14-0.4.1-1PGSTY.el10.aarch64.rpm
postgresql-14-typeid 0.4.1 d12.x86_64 pigsty 731.1 KiB postgresql-14-typeid_0.4.1-1PGSTY~bookworm_amd64.deb
postgresql-14-typeid 0.4.1 d12.aarch64 pigsty 612.0 KiB postgresql-14-typeid_0.4.1-1PGSTY~bookworm_arm64.deb
postgresql-14-typeid 0.4.1 d13.x86_64 pigsty 732.1 KiB postgresql-14-typeid_0.4.1-1PGSTY~trixie_amd64.deb
postgresql-14-typeid 0.4.1 d13.aarch64 pigsty 612.7 KiB postgresql-14-typeid_0.4.1-1PGSTY~trixie_arm64.deb
postgresql-14-typeid 0.4.1 u22.x86_64 pigsty 813.3 KiB postgresql-14-typeid_0.4.1-1PGSTY~jammy_amd64.deb
postgresql-14-typeid 0.4.1 u22.aarch64 pigsty 724.5 KiB postgresql-14-typeid_0.4.1-1PGSTY~jammy_arm64.deb
postgresql-14-typeid 0.4.1 u24.x86_64 pigsty 807.1 KiB postgresql-14-typeid_0.4.1-1PGSTY~noble_amd64.deb
postgresql-14-typeid 0.4.1 u24.aarch64 pigsty 715.2 KiB postgresql-14-typeid_0.4.1-1PGSTY~noble_arm64.deb
postgresql-14-typeid 0.4.1 u26.x86_64 pigsty 800.6 KiB postgresql-14-typeid_0.4.1-1PGSTY~resolute_amd64.deb
postgresql-14-typeid 0.4.1 u26.aarch64 pigsty 712.9 KiB postgresql-14-typeid_0.4.1-1PGSTY~resolute_arm64.deb

Source

pig build pkg pg_typeid;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_typeid;		# install via package name, for the active PG version
pig install typeid;		# install by extension name, for the current active PG version

pig install typeid -v 18;   # install for PG 18
pig install typeid -v 17;   # install for PG 17
pig install typeid -v 16;   # install for PG 16
pig install typeid -v 15;   # install for PG 15
pig install typeid -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION typeid;

Usage

typeid: TypeID support for PostgreSQL - type-safe, sortable UUIDs with a prefix

TypeID is an extension of UUIDv7 with a type prefix, stored internally as a prefix + binary UUID.

CREATE EXTENSION typeid;

Functions

Function Return Type Description
typeid_generate(prefix TEXT) typeid Generate a new TypeID with the given prefix
typeid_generate_nil() typeid Generate a TypeID with an empty prefix
typeid_is_valid(input TEXT) BOOLEAN Check if a TypeID string is valid
typeid_prefix(typeid) TEXT Extract the prefix from a TypeID
typeid_to_uuid(typeid) UUID Convert a TypeID to a UUID
uuid_to_typeid(prefix TEXT, uuid UUID) typeid Convert a UUID to a TypeID
typeid_uuid_generate_v7() UUID Generate a UUID v7
typeid_has_prefix(typeid, prefix TEXT) BOOLEAN Check if a TypeID has a specific prefix
typeid_is_nil_prefix(typeid) BOOLEAN Check if a TypeID has a nil prefix
typeid_generate_batch(prefix TEXT, count INTEGER) SETOF typeid Generate a batch of TypeIDs

Operators

  • <, <=, =, >=, >, <> for comparing TypeIDs
  • @> for checking if a TypeID has a certain prefix (e.g. id @> 'user')
  • B-tree operator class for indexing

Examples

-- Create table with TypeID primary key
CREATE TABLE users (
  id typeid DEFAULT typeid_generate('user') NOT NULL PRIMARY KEY,
  created_at timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL
);

-- Insert data
INSERT INTO users (id) SELECT typeid_generate('user') FROM generate_series(1, 100);

-- Extract prefix
SELECT typeid_prefix(id) FROM users LIMIT 1;  -- 'user'

-- Check prefix with operator
SELECT * FROM users WHERE id @> 'user';

-- Convert to UUID
SELECT typeid_to_uuid(id) FROM users LIMIT 1;

Table reader