pg_array_math
pg_array_math · Elementwise arithmetic and mathematical functions for one-dimensional numeric arrays.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102360 | pg_array_math | pg_array_math | 1.0 | FUNC | C |
Usage
Sources:
pg_array_math provides immutable, strict mathematical functions over one-dimensional arrays of smallint, integer, bigint, real, double precision or numeric. The reviewed source does not declare a license or a supported PostgreSQL-major matrix.
Array operations
The API is array_add, array_sub, array_mul, array_div, array_add_scalar, array_mul_scalar, array_power, array_sqrt, array_abs, array_log and array_exp. Two-array operations require the same element type and length. The result preserves the first array’s lower bound; NULL elements propagate, and a NULL input returns NULL.
Limits
Multidimensional arrays, unsupported types, division by zero, invalid domains and numeric overflow raise errors. array_log and array_exp accept only floating-point or numeric arrays. Results retain the input type: integer division truncates, and integer power/square-root results are not floating-point approximations. Cast deliberately before computation. The relocatable C extension requires no preload; installation uses the ordinary untrusted-extension administrator boundary.