pgcrockford: Crockford Base 32 encoding for unsigned ints

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pgcrockford: Crockford Base 32 encoding for unsigned ints

Michael Glaesemann-2
The pgcrockford extension provides Base 32 encoded integers as a
PostgreSQL base type. From [Douglas Crockford's
requirements][crockford] for the specification, the encoding should

> - Be human readable and machine readable.
> - Be compact. Humans have difficulty in manipulating long strings of arbitrary symbols.
> - Be error resistant. Entering the symbols must not require keyboarding gymnastics.
> - Be pronounceable. Humans should be able to accurately transmit the symbols to other humans using a telephone.

[crockford]: https://www.crockford.com/base32.html

The motivation for pgcrockford is to provide a more humane display of
values used for surrogate keys while preserving space efficiency:
crockford values are represented as alpha-numeric strings while using
unsigned integers for their implementation.


A quick example:

select 'POSTGRESQL'::crockford8, 'POSTGRESQL'::crockford8::int8;
 crockford8 |      int8      
------------+-----------------
 P0STGRESQ1 | 774943659222753
(1 row)


https://github.com/grzm/pgcrockford

Cheers!

Michael Glaesemann
grzm seespotcode net