跳转到主要内容

pg_text_semver

PostgreSQL 语义版本域类型与比较运算符

pg_text_semver · PostgreSQL 语义版本域类型与比较运算符

概览

ID扩展软件包版本类别许可证编程语言
3520pg_text_semverpg_text_semver1.2.1TYPEPostgreSQLSQL
属性可执行文件动态库需要预加载需要建扩展可迁移可信
----d-r否否否是是否
关联
相关扩展semver debversion

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY1.2.119 18 17 16 15pg_text_semver-
RPMPIGSTY1.2.119 18 17 16 15pg_text_semver_$v-
DEBPIGSTY1.2.119 18 17 16 15postgresql-$v-pg-text-semver-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
el8.aarch64N/APIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
el9.x86_64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
el9.aarch64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
el10.x86_64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
el10.aarch64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
d12.x86_64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
d12.aarch64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
d13.x86_64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
d13.aarch64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
u22.x86_64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
u22.aarch64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
u24.x86_64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
u24.aarch64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
u26.x86_64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
u26.aarch64PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1PIGSTY 1.2.1
软件包版本平台仓库大小下载
pg_text_semver_191.2.1el9.x86_64pigsty21.6 KiBpg_text_semver_19-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_191.2.1el9.aarch64pigsty21.6 KiBpg_text_semver_19-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_191.2.1el10.x86_64pigsty21.7 KiBpg_text_semver_19-1.2.1-1PGSTY.el10.noarch.rpm
pg_text_semver_191.2.1el10.aarch64pigsty21.7 KiBpg_text_semver_19-1.2.1-1PGSTY.el10.noarch.rpm
postgresql-19-pg-text-semver1.2.1d12.x86_64pigsty19.3 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-19-pg-text-semver1.2.1d12.aarch64pigsty19.3 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-19-pg-text-semver1.2.1d13.x86_64pigsty19.3 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-19-pg-text-semver1.2.1d13.aarch64pigsty19.3 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-19-pg-text-semver1.2.1u22.x86_64pigsty19.9 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-19-pg-text-semver1.2.1u22.aarch64pigsty19.9 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-19-pg-text-semver1.2.1u24.x86_64pigsty19.8 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-19-pg-text-semver1.2.1u24.aarch64pigsty19.8 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-19-pg-text-semver1.2.1u26.x86_64pigsty19.8 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb
postgresql-19-pg-text-semver1.2.1u26.aarch64pigsty19.8 KiBpostgresql-19-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb
软件包版本平台仓库大小下载
pg_text_semver_181.2.1el8.x86_64pigsty21.9 KiBpg_text_semver_18-1.2.1-1PGSTY.el8.noarch.rpm
pg_text_semver_181.2.1el8.aarch64pigsty21.9 KiBpg_text_semver_18-1.2.1-1PGSTY.el8.noarch.rpm
pg_text_semver_181.2.1el9.x86_64pigsty21.6 KiBpg_text_semver_18-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_181.2.1el9.aarch64pigsty21.6 KiBpg_text_semver_18-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_181.2.1el10.x86_64pigsty21.7 KiBpg_text_semver_18-1.2.1-1PGSTY.el10.noarch.rpm
pg_text_semver_181.2.1el10.aarch64pigsty21.7 KiBpg_text_semver_18-1.2.1-1PGSTY.el10.noarch.rpm
postgresql-18-pg-text-semver1.2.1d12.x86_64pigsty19.3 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-18-pg-text-semver1.2.1d12.aarch64pigsty19.3 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-18-pg-text-semver1.2.1d13.x86_64pigsty19.3 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-18-pg-text-semver1.2.1d13.aarch64pigsty19.3 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-18-pg-text-semver1.2.1u22.x86_64pigsty19.8 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-18-pg-text-semver1.2.1u22.aarch64pigsty19.8 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-18-pg-text-semver1.2.1u24.x86_64pigsty19.7 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-18-pg-text-semver1.2.1u24.aarch64pigsty19.7 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-18-pg-text-semver1.2.1u26.x86_64pigsty19.8 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb
postgresql-18-pg-text-semver1.2.1u26.aarch64pigsty19.8 KiBpostgresql-18-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb
软件包版本平台仓库大小下载
pg_text_semver_171.2.1el8.x86_64pigsty21.9 KiBpg_text_semver_17-1.2.1-1PGSTY.el8.noarch.rpm
pg_text_semver_171.2.1el8.aarch64pigsty21.9 KiBpg_text_semver_17-1.2.1-1PGSTY.el8.noarch.rpm
pg_text_semver_171.2.1el9.x86_64pigsty21.6 KiBpg_text_semver_17-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_171.2.1el9.aarch64pigsty21.6 KiBpg_text_semver_17-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_171.2.1el10.x86_64pigsty21.7 KiBpg_text_semver_17-1.2.1-1PGSTY.el10.noarch.rpm
pg_text_semver_171.2.1el10.aarch64pigsty21.7 KiBpg_text_semver_17-1.2.1-1PGSTY.el10.noarch.rpm
postgresql-17-pg-text-semver1.2.1d12.x86_64pigsty19.3 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-17-pg-text-semver1.2.1d12.aarch64pigsty19.3 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-17-pg-text-semver1.2.1d13.x86_64pigsty19.3 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-17-pg-text-semver1.2.1d13.aarch64pigsty19.3 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-17-pg-text-semver1.2.1u22.x86_64pigsty19.8 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-17-pg-text-semver1.2.1u22.aarch64pigsty19.8 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-17-pg-text-semver1.2.1u24.x86_64pigsty19.8 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-17-pg-text-semver1.2.1u24.aarch64pigsty19.8 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-17-pg-text-semver1.2.1u26.x86_64pigsty19.8 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb
postgresql-17-pg-text-semver1.2.1u26.aarch64pigsty19.8 KiBpostgresql-17-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb
软件包版本平台仓库大小下载
pg_text_semver_161.2.1el8.x86_64pigsty21.9 KiBpg_text_semver_16-1.2.1-1PGSTY.el8.noarch.rpm
pg_text_semver_161.2.1el8.aarch64pigsty21.9 KiBpg_text_semver_16-1.2.1-1PGSTY.el8.noarch.rpm
pg_text_semver_161.2.1el9.x86_64pigsty21.6 KiBpg_text_semver_16-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_161.2.1el9.aarch64pigsty21.6 KiBpg_text_semver_16-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_161.2.1el10.x86_64pigsty21.7 KiBpg_text_semver_16-1.2.1-1PGSTY.el10.noarch.rpm
pg_text_semver_161.2.1el10.aarch64pigsty21.7 KiBpg_text_semver_16-1.2.1-1PGSTY.el10.noarch.rpm
postgresql-16-pg-text-semver1.2.1d12.x86_64pigsty19.3 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-16-pg-text-semver1.2.1d12.aarch64pigsty19.3 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-16-pg-text-semver1.2.1d13.x86_64pigsty19.3 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-16-pg-text-semver1.2.1d13.aarch64pigsty19.3 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-16-pg-text-semver1.2.1u22.x86_64pigsty19.8 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-16-pg-text-semver1.2.1u22.aarch64pigsty19.8 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-16-pg-text-semver1.2.1u24.x86_64pigsty19.8 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-16-pg-text-semver1.2.1u24.aarch64pigsty19.8 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-16-pg-text-semver1.2.1u26.x86_64pigsty19.8 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb
postgresql-16-pg-text-semver1.2.1u26.aarch64pigsty19.8 KiBpostgresql-16-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb
软件包版本平台仓库大小下载
pg_text_semver_151.2.1el8.x86_64pigsty21.9 KiBpg_text_semver_15-1.2.1-1PGSTY.el8.noarch.rpm
pg_text_semver_151.2.1el8.aarch64pigsty21.9 KiBpg_text_semver_15-1.2.1-1PGSTY.el8.noarch.rpm
pg_text_semver_151.2.1el9.x86_64pigsty21.6 KiBpg_text_semver_15-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_151.2.1el9.aarch64pigsty21.6 KiBpg_text_semver_15-1.2.1-1PGSTY.el9.noarch.rpm
pg_text_semver_151.2.1el10.x86_64pigsty21.7 KiBpg_text_semver_15-1.2.1-1PGSTY.el10.noarch.rpm
pg_text_semver_151.2.1el10.aarch64pigsty21.7 KiBpg_text_semver_15-1.2.1-1PGSTY.el10.noarch.rpm
postgresql-15-pg-text-semver1.2.1d12.x86_64pigsty19.3 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-15-pg-text-semver1.2.1d12.aarch64pigsty19.3 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~bookworm_all.deb
postgresql-15-pg-text-semver1.2.1d13.x86_64pigsty19.3 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-15-pg-text-semver1.2.1d13.aarch64pigsty19.3 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~trixie_all.deb
postgresql-15-pg-text-semver1.2.1u22.x86_64pigsty19.9 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-15-pg-text-semver1.2.1u22.aarch64pigsty19.9 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~jammy_all.deb
postgresql-15-pg-text-semver1.2.1u24.x86_64pigsty19.8 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-15-pg-text-semver1.2.1u24.aarch64pigsty19.8 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~noble_all.deb
postgresql-15-pg-text-semver1.2.1u26.x86_64pigsty19.8 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb
postgresql-15-pg-text-semver1.2.1u26.aarch64pigsty19.8 KiBpostgresql-15-pg-text-semver_1.2.1-1PGSTY~resolute_all.deb

源码

pig build pkg pg_text_semver;		# build rpm/deb

安装

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

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

使用 pig 安装扩展。

pig install pg_text_semver;		# install by package name

pig install pg_text_semver -v 19;   # install for PG 19
pig install pg_text_semver -v 18;   # install for PG 18
pig install pg_text_semver -v 17;   # install for PG 17
pig install pg_text_semver -v 16;   # install for PG 16
pig install pg_text_semver -v 15;   # install for PG 15

在数据库中创建扩展。

CREATE EXTENSION pg_text_semver;

用法

来源:README,META.json,Tag v1.2.1

pg_text_semver 在 PostgreSQL text 之上实现 Semantic Versioning 2.0.0,并使用 semver domain,而不是自定义 C type。

核心类型与函数

CREATE EXTENSION pg_text_semver;

SELECT '1.2.3'::semver < '2.0.0'::semver;
SELECT semver_cmp('1.2.3'::semver, '1.2.4'::semver);
SELECT semver_regexp(true);
SELECT '1.2.3-alpha.1+build5'::semver::semver_parsed;
  • semver:基于 text 的 domain,并带有 SemVer 校验。
  • semver_parsed:用于排序与索引的解析后 composite type。
  • semver_prerelease:用于 prerelease 标识符的 domain。
  • semver_cmp(...):semver 与 semver_parsed 的比较函数。
  • semver_regexp(include_captures boolean):暴露校验 regex。

额外辅助函数

当前 README 还记录了 PGXN version range 辅助函数:

  • meta_pgxn_version_range(text)
  • meta_pgxn_version_range_cmp(text, text)
  • nonsemver_cmp(text, text, text)

注意事项

  • 该扩展更偏向规范导向、基于 text 的实现,而不是较低层的 C-based alternatives。
  • 上游 README 仍然是权威用户参考;这次刷新主要是使内容与文档中的 1.2.1 helper set 对齐。

表格阅读器