semver
pg_semver : Semantic version data type
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3510 | semver | pg_semver | 0.42.0 |
TYPE | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pg_text_semver debversion |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 0.42.0 |
18 17 16 15 14 | pg_semver |
- |
| RPM | PGDG | 0.42.0 |
18 17 16 15 14 | semver_$v |
- |
| DEB | PGDG | 0.42.0 |
18 17 16 15 14 | postgresql-$v-semver |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 |
| el8.aarch64 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 |
| el9.x86_64 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 |
| el9.aarch64 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 |
| el10.x86_64 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 |
| el10.aarch64 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 | PIGSTY 0.42.0 |
| d12.x86_64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
| d12.aarch64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
| d13.x86_64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
| d13.aarch64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
| u22.x86_64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
| u22.aarch64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
| u24.x86_64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
| u24.aarch64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
| u26.x86_64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
| u26.aarch64 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 | PGDG 0.42.0 |
Source
github.com/theory/pg-semver
pg-semver-0.42.0.tar.gz
Install
Make sure PGDG repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
semver provides a Semantic Versioning 2.0.0 data type, comparison operators and the semverrange range type. Version 0.42.0 changes hashing: after upgrading, rebuild every hash index on semver values.
Core Workflow
Operational Boundaries
semver(text) and casts from text require valid semantic versions; to_semver(text) performs more permissive conversion, and is_semver(text) checks validity. get_semver_major, get_semver_minor and get_semver_patch return integer components; get_semver_prerelease returns the prerelease text. Casts also accept numeric, real, double precision, integer, bigint and smallint. Version 0.42.0 rejects Infinity and NaN instead of producing malformed versions.
The comparison operators =, <>, <, <=, > and >=, plus MIN(semver) and MAX(semver), use semantic ordering. A prerelease sorts before its final release; build metadata does not affect precedence. Btree and hash indexes are available. semverrange supports standard range operations.
Install this native, untrusted extension with administrator privileges. After installing 0.42.0, run ALTER EXTENSION semver UPDATE and use REINDEX on every existing hash index containing semver keys. The hash change is not repaired by updating the extension’s SQL definitions alone. The release also fixes ordering of alphanumeric prerelease identifiers beginning with a digit and validation of strings with multiple plus signs. When upgrading from old releases, inspect the upstream compatibility notes for previously accepted invalid values.