base36
base36
pg_base36 : Integer Base36 types
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4800 | base36 | pg_base36 | 1.0.0 | FUNC | MIT | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| See Also | base62 pg_base58 pg_polyline uri pg_curl url_encode pg_rewrite sepgsql |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.0 | 18 17 16 15 14 | pg_base36 | - |
| RPM | PIGSTY | 1.0.0 | 18 17 16 15 14 | pg_base36_$v | - |
| DEB | PIGSTY | 1.0.0 | 18 17 16 15 14 | postgresql-$v-base36 | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
el8.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
el9.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
el9.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
el10.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
el10.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
d12.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
d12.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
d13.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
d13.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
u22.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
u22.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
u24.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
u24.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 |
Source
pig build pkg pg_base36; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pg_base36; # install via package name, for the active PG version
pig install base36; # install by extension name, for the current active PG version
pig install base36 -v 18; # install for PG 18
pig install base36 -v 17; # install for PG 17
pig install base36 -v 16; # install for PG 16
pig install base36 -v 15; # install for PG 15
pig install base36 -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION base36;Usage
Provides data types for encoding and decoding values using the base36 scheme, with conversion between base36 and integer types.
CREATE EXTENSION base36;Types
| Type | Storage | Max String Length | Max Numeric Value |
|---|---|---|---|
base36 | 4 bytes (int) | 6 characters | 2,147,483,647 |
bigbase36 | 8 bytes (bigint) | 13 characters | 9,223,372,036,854,775,807 |
Examples
-- Encode integer to base36
SELECT 1234567::base36; -- 'qglj'
-- Decode base36 to integer
SELECT 'qglj'::base36::int; -- 1234567
-- Bigbase36 for larger values
SELECT 9223372036854775807::bigbase36; -- 'i1y004og0svr'
SELECT 'i1y004og0svr'::bigbase36::bigint; -- 9223372036854775807Last updated on