crockford
pgcrockford · Crockford Base32 encoded unsigned integer data types
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100296 | crockford | pgcrockford | 0.8.34 | TYPE | PostgreSQL | C |
PostgreSQL · 11
Usage
Sources:
crockford 0.8.34 provides compact unsigned integer types whose textual form uses Crockford Base32. It is useful for human-facing identifiers that need case-insensitive, visually tolerant text, while retaining numeric comparison, arithmetic, and index support.
Core Workflow
Choose the storage width, insert Base32 text, and cast integers when the input represents a numeric value:
Text input is decoded as Base32, whereas an integer cast preserves the integer value. Consequently, the text literal 10 represents decimal 32, while integer 10 is rendered as A.
Type and Operator Index
crockford2stores an unsigned 16-bit value, up to1ZZZ.crockford4stores an unsigned 32-bit value, up to3ZZZZZZ.crockford8stores an unsigned 64-bit value, up toFZZZZZZZZZZZZ.- Comparison, arithmetic, and bitwise operators are supplied with B-tree and hash operator classes.
The parser accepts lower- or upper-case input and maps the ambiguous letters I/L and O to 1 and 0; U is excluded by the Crockford alphabet.
Operational Notes
The types are unsigned, so casts to signed PostgreSQL integers can overflow. Arithmetic also performs range checks. If installed into a schema absent from search_path, schema-qualify operators with PostgreSQL’s OPERATOR(schema.operator) syntax. The reviewed upstream version was tested against PostgreSQL 11; validate compilation, dump/restore, casts, and overflow behavior on newer server majors.