跳转到主要内容

base62

Base62编码解码扩展

pg_base62 · Base62编码解码扩展

概览

ID扩展软件包版本类别许可证编程语言
4820base62pg_base620.0.1FUNCMITC
属性可执行文件动态库需要预加载需要建扩展可迁移可信
--s-d-r否是否是是否

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY0.0.119 18 17 16 15pg_base62-
RPMPIGSTY0.0.119 18 17 16 15pg_base62_$v-
DEBPIGSTY0.0.119 18 17 16 15postgresql-$v-base62-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el8.aarch64N/APIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el9.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el9.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el10.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el10.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d12.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d12.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d13.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d13.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u22.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u22.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u24.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u24.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u26.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u26.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
软件包版本平台仓库大小下载
pg_base62_190.0.1el9.x86_64pigsty34.5 KiBpg_base62_19-0.0.1-1PGSTY.el9.x86_64.rpm
pg_base62_190.0.1el9.aarch64pigsty34.6 KiBpg_base62_19-0.0.1-1PGSTY.el9.aarch64.rpm
pg_base62_190.0.1el10.x86_64pigsty35.0 KiBpg_base62_19-0.0.1-1PGSTY.el10.x86_64.rpm
pg_base62_190.0.1el10.aarch64pigsty34.8 KiBpg_base62_19-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-19-base620.0.1d12.x86_64pigsty25.5 KiBpostgresql-19-base62_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-19-base620.0.1d12.aarch64pigsty25.3 KiBpostgresql-19-base62_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-19-base620.0.1d13.x86_64pigsty25.9 KiBpostgresql-19-base62_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-19-base620.0.1d13.aarch64pigsty25.8 KiBpostgresql-19-base62_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-19-base620.0.1u22.x86_64pigsty26.7 KiBpostgresql-19-base62_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-19-base620.0.1u22.aarch64pigsty26.8 KiBpostgresql-19-base62_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-19-base620.0.1u24.x86_64pigsty27.1 KiBpostgresql-19-base62_0.0.1-1PGSTY~noble_amd64.deb
postgresql-19-base620.0.1u24.aarch64pigsty26.9 KiBpostgresql-19-base62_0.0.1-1PGSTY~noble_arm64.deb
postgresql-19-base620.0.1u26.x86_64pigsty27.2 KiBpostgresql-19-base62_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-19-base620.0.1u26.aarch64pigsty27.1 KiBpostgresql-19-base62_0.0.1-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_base62_180.0.1el8.x86_64pigsty34.8 KiBpg_base62_18-0.0.1-1PGSTY.el8.x86_64.rpm
pg_base62_180.0.1el8.aarch64pigsty34.4 KiBpg_base62_18-0.0.1-1PGSTY.el8.aarch64.rpm
pg_base62_180.0.1el9.x86_64pigsty34.6 KiBpg_base62_18-0.0.1-1PGSTY.el9.x86_64.rpm
pg_base62_180.0.1el9.aarch64pigsty34.5 KiBpg_base62_18-0.0.1-1PGSTY.el9.aarch64.rpm
pg_base62_180.0.1el10.x86_64pigsty35.0 KiBpg_base62_18-0.0.1-1PGSTY.el10.x86_64.rpm
pg_base62_180.0.1el10.aarch64pigsty34.8 KiBpg_base62_18-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-18-base620.0.1d12.x86_64pigsty25.5 KiBpostgresql-18-base62_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-18-base620.0.1d12.aarch64pigsty25.3 KiBpostgresql-18-base62_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-18-base620.0.1d13.x86_64pigsty25.8 KiBpostgresql-18-base62_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-18-base620.0.1d13.aarch64pigsty25.7 KiBpostgresql-18-base62_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-18-base620.0.1u22.x86_64pigsty26.7 KiBpostgresql-18-base62_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-18-base620.0.1u22.aarch64pigsty26.8 KiBpostgresql-18-base62_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-18-base620.0.1u24.x86_64pigsty27.0 KiBpostgresql-18-base62_0.0.1-1PGSTY~noble_amd64.deb
postgresql-18-base620.0.1u24.aarch64pigsty26.9 KiBpostgresql-18-base62_0.0.1-1PGSTY~noble_arm64.deb
postgresql-18-base620.0.1u26.x86_64pigsty27.2 KiBpostgresql-18-base62_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-18-base620.0.1u26.aarch64pigsty27.1 KiBpostgresql-18-base62_0.0.1-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_base62_170.0.1el8.x86_64pigsty34.8 KiBpg_base62_17-0.0.1-1PGSTY.el8.x86_64.rpm
pg_base62_170.0.1el8.aarch64pigsty34.4 KiBpg_base62_17-0.0.1-1PGSTY.el8.aarch64.rpm
pg_base62_170.0.1el9.x86_64pigsty34.6 KiBpg_base62_17-0.0.1-1PGSTY.el9.x86_64.rpm
pg_base62_170.0.1el9.aarch64pigsty34.5 KiBpg_base62_17-0.0.1-1PGSTY.el9.aarch64.rpm
pg_base62_170.0.1el10.x86_64pigsty35.0 KiBpg_base62_17-0.0.1-1PGSTY.el10.x86_64.rpm
pg_base62_170.0.1el10.aarch64pigsty34.7 KiBpg_base62_17-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-17-base620.0.1d12.x86_64pigsty25.5 KiBpostgresql-17-base62_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-17-base620.0.1d12.aarch64pigsty25.4 KiBpostgresql-17-base62_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-17-base620.0.1d13.x86_64pigsty25.8 KiBpostgresql-17-base62_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-17-base620.0.1d13.aarch64pigsty25.6 KiBpostgresql-17-base62_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-17-base620.0.1u22.x86_64pigsty27.2 KiBpostgresql-17-base62_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-17-base620.0.1u22.aarch64pigsty27.2 KiBpostgresql-17-base62_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-17-base620.0.1u24.x86_64pigsty27.1 KiBpostgresql-17-base62_0.0.1-1PGSTY~noble_amd64.deb
postgresql-17-base620.0.1u24.aarch64pigsty26.9 KiBpostgresql-17-base62_0.0.1-1PGSTY~noble_arm64.deb
postgresql-17-base620.0.1u26.x86_64pigsty27.2 KiBpostgresql-17-base62_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-17-base620.0.1u26.aarch64pigsty27.0 KiBpostgresql-17-base62_0.0.1-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_base62_160.0.1el8.x86_64pigsty34.8 KiBpg_base62_16-0.0.1-1PGSTY.el8.x86_64.rpm
pg_base62_160.0.1el8.aarch64pigsty34.4 KiBpg_base62_16-0.0.1-1PGSTY.el8.aarch64.rpm
pg_base62_160.0.1el9.x86_64pigsty34.6 KiBpg_base62_16-0.0.1-1PGSTY.el9.x86_64.rpm
pg_base62_160.0.1el9.aarch64pigsty34.5 KiBpg_base62_16-0.0.1-1PGSTY.el9.aarch64.rpm
pg_base62_160.0.1el10.x86_64pigsty35.0 KiBpg_base62_16-0.0.1-1PGSTY.el10.x86_64.rpm
pg_base62_160.0.1el10.aarch64pigsty34.7 KiBpg_base62_16-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-16-base620.0.1d12.x86_64pigsty25.5 KiBpostgresql-16-base62_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-16-base620.0.1d12.aarch64pigsty25.4 KiBpostgresql-16-base62_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-16-base620.0.1d13.x86_64pigsty25.8 KiBpostgresql-16-base62_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-16-base620.0.1d13.aarch64pigsty25.6 KiBpostgresql-16-base62_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-16-base620.0.1u22.x86_64pigsty27.2 KiBpostgresql-16-base62_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-16-base620.0.1u22.aarch64pigsty27.2 KiBpostgresql-16-base62_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-16-base620.0.1u24.x86_64pigsty27.1 KiBpostgresql-16-base62_0.0.1-1PGSTY~noble_amd64.deb
postgresql-16-base620.0.1u24.aarch64pigsty26.9 KiBpostgresql-16-base62_0.0.1-1PGSTY~noble_arm64.deb
postgresql-16-base620.0.1u26.x86_64pigsty27.2 KiBpostgresql-16-base62_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-16-base620.0.1u26.aarch64pigsty27.0 KiBpostgresql-16-base62_0.0.1-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_base62_150.0.1el8.x86_64pigsty34.8 KiBpg_base62_15-0.0.1-1PGSTY.el8.x86_64.rpm
pg_base62_150.0.1el8.aarch64pigsty34.4 KiBpg_base62_15-0.0.1-1PGSTY.el8.aarch64.rpm
pg_base62_150.0.1el9.x86_64pigsty34.6 KiBpg_base62_15-0.0.1-1PGSTY.el9.x86_64.rpm
pg_base62_150.0.1el9.aarch64pigsty34.5 KiBpg_base62_15-0.0.1-1PGSTY.el9.aarch64.rpm
pg_base62_150.0.1el10.x86_64pigsty35.0 KiBpg_base62_15-0.0.1-1PGSTY.el10.x86_64.rpm
pg_base62_150.0.1el10.aarch64pigsty34.7 KiBpg_base62_15-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-15-base620.0.1d12.x86_64pigsty25.6 KiBpostgresql-15-base62_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-15-base620.0.1d12.aarch64pigsty25.5 KiBpostgresql-15-base62_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-15-base620.0.1d13.x86_64pigsty26.0 KiBpostgresql-15-base62_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-15-base620.0.1d13.aarch64pigsty25.8 KiBpostgresql-15-base62_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-15-base620.0.1u22.x86_64pigsty27.2 KiBpostgresql-15-base62_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-15-base620.0.1u22.aarch64pigsty27.2 KiBpostgresql-15-base62_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-15-base620.0.1u24.x86_64pigsty27.2 KiBpostgresql-15-base62_0.0.1-1PGSTY~noble_amd64.deb
postgresql-15-base620.0.1u24.aarch64pigsty27.1 KiBpostgresql-15-base62_0.0.1-1PGSTY~noble_arm64.deb
postgresql-15-base620.0.1u26.x86_64pigsty27.3 KiBpostgresql-15-base62_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-15-base620.0.1u26.aarch64pigsty27.2 KiBpostgresql-15-base62_0.0.1-1PGSTY~resolute_arm64.deb

源码

pig build pkg pg_base62;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

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

使用 pig 安装扩展。

pig install pg_base62;		# install by package name
pig install base62;		# install by extension name

pig install base62 -v 19;   # install for PG 19
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

在数据库中创建扩展。

CREATE EXTENSION base62;

用法

base62: PostgreSQL 的 base62 编解码数据类型

提供使用 base62 方案(0-9、A-Z、a-z)进行编码和解码的数据类型。

CREATE EXTENSION base62;

类型

类型存储最大字符串长度最大数值
base624 字节(int)6 字符2,147,483,647
bigbase628 字节(bigint)11 字符9,223,372,036,854,775,807
hugebase6216 字节20 字符(bytea 转换)

示例

-- 编码/解码 base62
SELECT 2147483647::base62;          -- '2LKcb1'
SELECT '2LKcb1'::base62::int;      -- 2147483647

-- 用于更大数值的 bigbase62
SELECT 9223372036854775807::bigbase62;           -- 'AzL8n0Y58m7'
SELECT 'AzL8n0Y58m7'::bigbase62::bigint;        -- 9223372036854775807

-- hugebase62 与 bytea 转换
SELECT 'AzL8n0Y58m7AzL8n0Y58'::hugebase62;
SELECT 'AzL8n0Y58m7AzL8n0Y58'::hugebase62::bytea;
SELECT '\x960c06065a6ed8ffff1e7149f40b1800'::bytea::hugebase62;

-- 注意:base62 区分大小写
SELECT '2lkcb'::base62::int;   -- 40933305
SELECT '2LKCB'::base62::int;   -- 34635195

表格阅读器