arraymath
Array math and operators that work element by element on the contents of arrays
Repository
pramsey/pgsql-arraymath
https://github.com/pramsey/pgsql-arraymath
Source
pgsql-arraymath-1.1.tar.gz
pgsql-arraymath-1.1.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_arraymath | 1.1 | FUNC | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4770 | arraymath | No | Yes | No | Yes | No | Yes | - |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.1 | 1817161514 | pg_arraymath | - |
| RPM | PIGSTY | 1.1 | 1817161514 | pg_arraymath_$v | - |
| DEB | PIGSTY | 1.1 | 1817161514 | postgresql-$v-pg-arraymath | - |
Build
You can build the RPM / DEB packages for pg_arraymath using pig build:
Install
You can install pg_arraymath directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
arraymath: element-by-element array operations for PostgreSQL
Provides element-by-element operators and utility functions for integer, float, and numeric arrays.
Operators
All operators are prefixed with @ to indicate element-by-element behavior. Works with array-vs-array (same length or cycling) and array-vs-scalar.
| Operator | Description | Returns |
|---|---|---|
@= | Element-by-element equality | boolean[] |
@< | Element-by-element less than | boolean[] |
@> | Element-by-element greater than | boolean[] |
@<= | Element-by-element less than or equals | boolean[] |
@>= | Element-by-element greater than or equals | boolean[] |
@+ | Element-by-element addition | same type |
@- | Element-by-element subtraction | same type |
@* | Element-by-element multiplication | same type |
@/ | Element-by-element division | same type |
Functions
| Function | Description |
|---|---|
array_sum(anyarray) | Sum of all elements |
array_avg(anyarray) | Average of all elements |
array_min(anyarray) | Minimum element |
array_max(anyarray) | Maximum element |
array_median(anyarray) | Median element |
array_sort(anyarray) | Sort ascending |
array_rsort(anyarray) | Sort descending |
Examples
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)