argm
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
argm | 1.1.1 | FUNC | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4755 | argm | No | Yes | No | Yes | No | Yes | - |
fix pg16+ varlena header with patch
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.1.1 | 1817161514 | argm | - |
| RPM | PIGSTY | 1.1.1 | 1817161514 | argm_$v | - |
| DEB | PIGSTY | 1.1.1 | 1817161514 | postgresql-$v-argm | - |
Build
You can build the RPM / DEB packages for argm using pig build:
Install
You can install argm directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources:
argm provides the polymorphic aggregates argmax, argmin, and anyold. They return a value from a selected row while grouping, avoiding a join or window-function pass when the row can be chosen by one or more sortable keys.
Core Workflow
argmax(value, key...) returns the value belonging to the lexicographically greatest key tuple. argmin selects the least tuple. Additional keys break ties without building a composite value:
Use anyold(value) when any member of a group is acceptable:
Important Objects
argmax(value, key [, key ...])selects the value associated with the greatest key tuple.argmin(value, key [, key ...])selects the value associated with the least key tuple.anyold(value)returns an arbitrary non-null value from the aggregate state.
The aggregates accept any value type; key types must have ordering support. The SQL definitions are parallel-safe and include combine and serialization functions for partial aggregation.
Semantics and Caveats
Key tuples use one ordering direction and one collation for the whole tuple, with null keys sorted last. If complete key tuples tie, the chosen value is unspecified; add a stable final key when deterministic results matter. As with other PostgreSQL aggregates, empty input produces NULL.
argm 1.1.x requires PostgreSQL 9.6 or newer. The extension is relocatable. Upgrading from 1.0.3 to 1.1.x requires dropping and recreating the extension because the aggregate state changed; the 1.1.0-to-1.1.1 upgrade does not change the public SQL surface.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)