debversion

Debian version number data type

Overview

PackageVersionCategoryLicenseLanguage
debversion1.2.0TYPEPostgreSQLSQL
IDExtensionBinLibLoadCreateTrustRelocSchema
3870debversionNoYesNoYesNoYes-
Relatedprefix semver unit pgpdf pglite_fusion md5hash asn1oid roaringbitmap

Version

TypeRepoVersionPG VerPackageDeps
EXTPGDG1.2.01817161514debversion-
DEBPGDG1.2.01817161514postgresql-$v-debversion-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el8.aarch64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el9.x86_64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el9.aarch64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el10.x86_64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el10.aarch64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
d12.x86_64
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
d12.aarch64
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
d13.x86_64
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
d13.aarch64
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
u22.x86_64
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
u22.aarch64
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
u24.x86_64
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
u24.aarch64
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0
PGDG 1.2.0

Install

You can install debversion directly. First, make sure the PGDG repository is added and enabled:

pig repo add pgdg -u          # Add PGDG repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install debversion;          # Install for current active PG version
pig ext install -y debversion -v 18  # PG 18
pig ext install -y debversion -v 17  # PG 17
pig ext install -y debversion -v 16  # PG 16
pig ext install -y debversion -v 15  # PG 15
pig ext install -y debversion -v 14  # PG 14
apt install -y postgresql-18-debversion   # PG 18
apt install -y postgresql-17-debversion   # PG 17
apt install -y postgresql-16-debversion   # PG 16
apt install -y postgresql-15-debversion   # PG 15
apt install -y postgresql-14-debversion   # PG 14

Create Extension:

CREATE EXTENSION debversion;

Usage

debversion: Debian version number type for PostgreSQL

The debversion extension provides Debian package version comparison functionality, implementing the same sorting logic used by dpkg.

CREATE EXTENSION debversion;

Data Type

The debversion type stores Debian package version strings and compares them according to the Debian versioning specification (epoch:upstream-revision format).

CREATE TABLE packages (
    name    text,
    version debversion
);

INSERT INTO packages VALUES ('foo', '1.0-1'), ('foo', '2.0-1'), ('foo', '1.0-2');

SELECT * FROM packages ORDER BY version;

Version Comparison

SELECT '1.60-26+b1'::debversion < '1.60+git20161116.90da8a0-1'::debversion;

Operators

Standard comparison operators are supported: =, <>, <, >, <=, >=.

The comparison algorithm mirrors dpkg --compare-versions, ensuring results identical to standard Debian package management utilities.


Last Modified 2026-03-12: add pg extension catalog (95749bf)