base32_4b
base32_4b · Base32 data type stored in four bytes with comparison operators.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100245 | base32_4b | base32_4b | 0.0.1 | TYPE | PostgreSQL | C |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
base32_4b defines a pass-by-value Base32 type with a four-byte internal representation. Use it only for identifiers accepted by the extension’s input function; it is a compact scalar type, not a general encoder for arbitrary byte strings.
Core Workflow
Validate application input with an explicit cast before bulk loading. The text casts are assignment casts rather than implicit casts, which helps keep comparisons type-specific.
Important Objects
base32_4bis the four-byte scalar type with text and binary input/output support.- Comparison operators
<,<=,=,<>,>=, and>provide ordering and equality. base32_4b_opsis the default B-tree operator class, so primary keys and B-tree indexes are supported.minandmaxaggregates are defined for the type.base32_4b_to_textandbase32_4b_from_textimplement assignment casts to and fromtext.
Caveats
The SQL surface defines no hash operator class, arithmetic, or general binary-to-Base32 conversion. Use a B-tree for indexed equality and ordering, and confirm that the extension’s ordering matches the application’s desired textual ordering.
The repository has only an initial 2015-era implementation and minimal documentation. Test accepted alphabet, case handling, invalid and boundary input, binary send/receive, index ordering, dump/restore, and the target PostgreSQL major version before adopting it. Four bytes of datum storage do not guarantee four bytes per table row because tuple headers, null bitmaps, and alignment also contribute.