base62

pg_base62 : Base62 extension for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4810
base62
pg_base62
0.0.1
FUNC
MIT
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--
No
Yes
No
Yes
no
no
Relationships
See Also
base36
pg_base58
pg_polyline
uri
pg_curl
url_encode
pg_rewrite
sepgsql

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
0.0.1
18
17
16
15
14
pg_base62-
RPM
PIGSTY
0.0.1
18
17
16
15
14
pg_base62_$v-
DEB
PIGSTY
0.0.1
18
17
16
15
14
postgresql-$v-base62-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el8.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el9.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el9.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el10.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el10.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
d12.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
d12.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
d13.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
d13.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
u22.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
u22.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
u24.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
u24.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1

Source

pig build pkg pg_base62;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_base62;		# install via package name, for the active PG version
pig install base62;		# install by extension name, for the current active PG version

pig install base62 -v 18;   # install for PG 18
pig install base62 -v 17;   # install for PG 17
pig install base62 -v 16;   # install for PG 16
pig install base62 -v 15;   # install for PG 15
pig install base62 -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION base62;

Usage

base62: base62 encoding/decoding data types for PostgreSQL

Provides data types for encoding and decoding values using the base62 scheme (0-9, A-Z, a-z).

CREATE EXTENSION base62;

Types

TypeStorageMax String LengthMax Numeric Value
base624 bytes (int)6 characters2,147,483,647
bigbase628 bytes (bigint)11 characters9,223,372,036,854,775,807
hugebase6216 bytes20 characters(bytea conversion)

Examples

-- Encode/decode base62
SELECT 2147483647::base62;          -- '2LKcb1'
SELECT '2LKcb1'::base62::int;      -- 2147483647

-- Bigbase62 for larger values
SELECT 9223372036854775807::bigbase62;           -- 'AzL8n0Y58m7'
SELECT 'AzL8n0Y58m7'::bigbase62::bigint;        -- 9223372036854775807

-- Hugebase62 with bytea conversion
SELECT 'AzL8n0Y58m7AzL8n0Y58'::hugebase62;
SELECT 'AzL8n0Y58m7AzL8n0Y58'::hugebase62::bytea;
SELECT '\x960c06065a6ed8ffff1e7149f40b1800'::bytea::hugebase62;

-- Note: base62 is case-sensitive
SELECT '2lkcb'::base62::int;   -- 40933305
SELECT '2LKCB'::base62::int;   -- 34635195
Last updated on