pg_conda
pg_conda · PostgreSQL extension adding conda ecosystem version types, aggregates, and functions.
Overview
PostgreSQL · 13, 14, 15, 16, 17
Usage
Sources:
- Official README
- Type and function implementation
- Extension control file
- Build compatibility declaration
pg_conda provides the condaversion type for storing and comparing Conda ecosystem version strings with Rattler’s Conda ordering rules. Use it for package metadata and dependency analysis after testing its comparison semantics against the spellings present in your data.
Core Workflow
Input is parsed with Rattler’s Conda version parser, while output preserves the original source spelling.
Objects
condaversionsupports equality, ordering, hashing, B-tree operators, and casts to and fromtext.min(condaversion)andmax(condaversion)use the extension’s ordering implementation.conda_is_dev(condaversion)andconda_is_post(condaversion)identify development and post-release components.conda_has_epoch(condaversion)andconda_has_local(condaversion)identify epoch and local components.conda_segments(condaversion) → text[]returns parsed version components.conda_major(condaversion) → bigintandconda_minor(condaversion) → bigintreturn numeric components when available, otherwiseNULLfor unsupported component shapes.
Comparison Caveat
In the reviewed 1.0.1 source, equality and hashing compare the normalized Rattler version, but total ordering compares that version and then the preserved source text. Consequently, equivalent spellings such as 1.1.0 and 1.01.0 can compare equal while sorting differently. This violates the consistency expected by PostgreSQL B-tree comparison and can affect B-tree or unique indexes and the choice returned by min(condaversion) or max(condaversion).
Canonicalize stored spellings or avoid relying on those index and aggregate semantics until the behavior is fixed upstream. Test equality, ordering, uniqueness, and upgrade behavior with your real version corpus.
Compatibility
The control file is not trusted and the extension is not relocatable, so installation normally requires a privileged role and objects remain in the installation schema. The current Cargo feature set declares PostgreSQL 13 through 17 and defaults to PostgreSQL 17; verify a package built specifically for the target major version.
The reviewed tree uses pgrx 0.18.1 and Rattler 0.36.0. Invalid input raises a PostgreSQL error. Pin the extension and dependency versions because changes in Rattler’s parser or ordering can change database-visible comparison behavior.