typeid
Allows to use TypeIDs in Postgres natively
pg_typeid : Allows to use TypeIDs in Postgres natively
Overview
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| See Also | pg_uuidv7 sequential_uuids pg_idkit pgx_ulid snowflake pg_uuid_v8 uuid-ossp pg_hashids pg_slug_gen base36 |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.3.0 |
18 17 16 15 14 | pg_typeid |
- |
| RPM | PIGSTY | 0.3.0 |
18 17 16 15 14 | pg_typeid_$v |
- |
| DEB | PIGSTY | 0.3.0 |
18 17 16 15 14 | postgresql-$v-typeid |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| el8.aarch64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| el9.x86_64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| el9.aarch64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| el10.x86_64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| el10.aarch64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| d12.x86_64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| d12.aarch64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| d13.x86_64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| d13.aarch64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| u22.x86_64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| u22.aarch64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| u24.x86_64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| u24.aarch64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| u26.x86_64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| u26.aarch64 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 |
Source
github.com/blitss/typeid-postgres
typeid-postgres-0.3.0.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
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.
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