evr
postgresql_evr · PostgreSQL extension for RPM epoch/version/release datatype parsing.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100278 | evr | postgresql_evr | 0.0.2 | TYPE | GPL-3.0 | SQL |
Usage
Sources:
evr is an archived, pure-PL/pgSQL helper for decomposing RPM epoch/version/release strings into composite values. Despite the project description, it does not implement RPM version comparison, ordering operators, or an indexable EVR data type.
Core Workflow
Install the extension and inspect how a version string is split into numeric and alphabetic segments:
evr_trigger() expects the target table to have columns named exactly epoch, version, release, and evr:
Objects
evr_array_itemis a composite(n numeric, s text)segment: numeric runs populaten, alphabetic runs populates.evr_tstoresepoch integer,version evr_array_item[], andrelease evr_array_item[].rpmver_array(varchar)removes non-alphanumeric separators and returns the segment array.evr_trigger()populatesNEW.evrfrom the four fixed column names.empty(text),isalpha(char),isalphanum(char), andisdigit(char)are public helper functions used by the parser.
Caveats
Parsing is ASCII-only and discards punctuation, so it does not preserve the original version string. It also does not implement RPM’s comparison rules, including special version semantics; never sort or compare packages by the textual rendering of evr_t.
When version or release is NULL, the trigger parses the literal string empty rather than producing an empty array. The generic helper names are installed in the target schema and can collide with application functions. The repository is archived, so treat this as a historical parser and implement comparison separately if exact RPM EVR semantics are required.