base62
base62
pg_base62 : Base62 extension for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4810 | base62
|
pg_base62
|
0.0.1 |
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 | base36
pg_base58
pg_polyline
uri
pg_curl
url_encode
pg_rewrite
sepgsql
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| 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 / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
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/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_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 14Create this extension with:
CREATE EXTENSION base62;Usage
Provides data types for encoding and decoding values using the base62 scheme (0-9, A-Z, a-z).
CREATE EXTENSION base62;Types
| Type | Storage | Max String Length | Max Numeric Value |
|---|---|---|---|
base62 |
4 bytes (int) | 6 characters | 2,147,483,647 |
bigbase62 |
8 bytes (bigint) | 11 characters | 9,223,372,036,854,775,807 |
hugebase62 |
16 bytes | 20 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; -- 34635195Last updated on