跳转到主要内容

arraymath

数组逐元素数学运算符包

pg_arraymath · 数组逐元素数学运算符包

概览

ID扩展软件包版本类别许可证编程语言
4780arraymathpg_arraymath1.1FUNCMITC
属性可执行文件动态库需要预加载需要建扩展可迁移可信
--s-d-r否是否是是否

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY1.119 18 17 16 15pg_arraymath-
RPMPIGSTY1.1.019 18 17 16 15pg_arraymath_$v-
DEBPIGSTY1.1.019 18 17 16 15postgresql-$v-pg-arraymath-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 1.1PIGSTY 1.1PIGSTY 1.1PIGSTY 1.1
el8.aarch64N/APIGSTY 1.1PIGSTY 1.1PIGSTY 1.1PIGSTY 1.1
el9.x86_64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
el9.aarch64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
el10.x86_64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
el10.aarch64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
d12.x86_64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
d12.aarch64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
d13.x86_64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
d13.aarch64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
u22.x86_64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
u22.aarch64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
u24.x86_64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
u24.aarch64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
u26.x86_64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
u26.aarch64PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0PIGSTY 1.1.0
软件包版本平台仓库大小下载
pg_arraymath_191.1.0el9.x86_64pigsty35.2 KiBpg_arraymath_19-1.1.0-1PGSTY.el9.x86_64.rpm
pg_arraymath_191.1.0el9.aarch64pigsty34.6 KiBpg_arraymath_19-1.1.0-1PGSTY.el9.aarch64.rpm
pg_arraymath_191.1.0el10.x86_64pigsty35.3 KiBpg_arraymath_19-1.1.0-1PGSTY.el10.x86_64.rpm
pg_arraymath_191.1.0el10.aarch64pigsty34.8 KiBpg_arraymath_19-1.1.0-1PGSTY.el10.aarch64.rpm
postgresql-19-pg-arraymath1.1.0d12.x86_64pigsty25.7 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~bookworm_amd64.deb
postgresql-19-pg-arraymath1.1.0d12.aarch64pigsty25.5 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~bookworm_arm64.deb
postgresql-19-pg-arraymath1.1.0d13.x86_64pigsty25.8 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~trixie_amd64.deb
postgresql-19-pg-arraymath1.1.0d13.aarch64pigsty25.6 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~trixie_arm64.deb
postgresql-19-pg-arraymath1.1.0u22.x86_64pigsty27.2 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~jammy_amd64.deb
postgresql-19-pg-arraymath1.1.0u22.aarch64pigsty27.1 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~jammy_arm64.deb
postgresql-19-pg-arraymath1.1.0u24.x86_64pigsty27.0 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~noble_amd64.deb
postgresql-19-pg-arraymath1.1.0u24.aarch64pigsty26.8 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~noble_arm64.deb
postgresql-19-pg-arraymath1.1.0u26.x86_64pigsty26.9 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~resolute_amd64.deb
postgresql-19-pg-arraymath1.1.0u26.aarch64pigsty26.8 KiBpostgresql-19-pg-arraymath_1.1.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_arraymath_181.1el8.x86_64pigsty34.2 KiBpg_arraymath_18-1.1-2.git20260702.4822319PGSTY.el8.x86_64.rpm
pg_arraymath_181.1el8.aarch64pigsty33.8 KiBpg_arraymath_18-1.1-2.git20260702.4822319PGSTY.el8.aarch64.rpm
pg_arraymath_181.1.0el9.x86_64pigsty34.9 KiBpg_arraymath_18-1.1.0-1PGSTY.el9.x86_64.rpm
pg_arraymath_181.1.0el9.aarch64pigsty34.2 KiBpg_arraymath_18-1.1.0-1PGSTY.el9.aarch64.rpm
pg_arraymath_181.1.0el10.x86_64pigsty34.9 KiBpg_arraymath_18-1.1.0-1PGSTY.el10.x86_64.rpm
pg_arraymath_181.1.0el10.aarch64pigsty34.6 KiBpg_arraymath_18-1.1.0-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-arraymath1.1.0d12.x86_64pigsty25.5 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-arraymath1.1.0d12.aarch64pigsty25.3 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-arraymath1.1.0d13.x86_64pigsty25.6 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~trixie_amd64.deb
postgresql-18-pg-arraymath1.1.0d13.aarch64pigsty25.3 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~trixie_arm64.deb
postgresql-18-pg-arraymath1.1.0u22.x86_64pigsty27.0 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~jammy_amd64.deb
postgresql-18-pg-arraymath1.1.0u22.aarch64pigsty26.7 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~jammy_arm64.deb
postgresql-18-pg-arraymath1.1.0u24.x86_64pigsty26.7 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~noble_amd64.deb
postgresql-18-pg-arraymath1.1.0u24.aarch64pigsty26.5 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~noble_arm64.deb
postgresql-18-pg-arraymath1.1.0u26.x86_64pigsty26.6 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~resolute_amd64.deb
postgresql-18-pg-arraymath1.1.0u26.aarch64pigsty26.5 KiBpostgresql-18-pg-arraymath_1.1.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_arraymath_171.1el8.x86_64pigsty34.2 KiBpg_arraymath_17-1.1-2.git20260702.4822319PGSTY.el8.x86_64.rpm
pg_arraymath_171.1el8.aarch64pigsty33.7 KiBpg_arraymath_17-1.1-2.git20260702.4822319PGSTY.el8.aarch64.rpm
pg_arraymath_171.1.0el9.x86_64pigsty34.9 KiBpg_arraymath_17-1.1.0-1PGSTY.el9.x86_64.rpm
pg_arraymath_171.1.0el9.aarch64pigsty34.2 KiBpg_arraymath_17-1.1.0-1PGSTY.el9.aarch64.rpm
pg_arraymath_171.1.0el10.x86_64pigsty34.9 KiBpg_arraymath_17-1.1.0-1PGSTY.el10.x86_64.rpm
pg_arraymath_171.1.0el10.aarch64pigsty34.6 KiBpg_arraymath_17-1.1.0-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-arraymath1.1.0d12.x86_64pigsty25.4 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-arraymath1.1.0d12.aarch64pigsty25.2 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-arraymath1.1.0d13.x86_64pigsty25.5 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~trixie_amd64.deb
postgresql-17-pg-arraymath1.1.0d13.aarch64pigsty25.3 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~trixie_arm64.deb
postgresql-17-pg-arraymath1.1.0u22.x86_64pigsty28.2 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~jammy_amd64.deb
postgresql-17-pg-arraymath1.1.0u22.aarch64pigsty28.0 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~jammy_arm64.deb
postgresql-17-pg-arraymath1.1.0u24.x86_64pigsty26.7 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~noble_amd64.deb
postgresql-17-pg-arraymath1.1.0u24.aarch64pigsty26.4 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~noble_arm64.deb
postgresql-17-pg-arraymath1.1.0u26.x86_64pigsty26.6 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~resolute_amd64.deb
postgresql-17-pg-arraymath1.1.0u26.aarch64pigsty26.4 KiBpostgresql-17-pg-arraymath_1.1.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_arraymath_161.1el8.x86_64pigsty34.2 KiBpg_arraymath_16-1.1-2.git20260702.4822319PGSTY.el8.x86_64.rpm
pg_arraymath_161.1el8.aarch64pigsty33.7 KiBpg_arraymath_16-1.1-2.git20260702.4822319PGSTY.el8.aarch64.rpm
pg_arraymath_161.1.0el9.x86_64pigsty34.9 KiBpg_arraymath_16-1.1.0-1PGSTY.el9.x86_64.rpm
pg_arraymath_161.1.0el9.aarch64pigsty34.2 KiBpg_arraymath_16-1.1.0-1PGSTY.el9.aarch64.rpm
pg_arraymath_161.1.0el10.x86_64pigsty34.9 KiBpg_arraymath_16-1.1.0-1PGSTY.el10.x86_64.rpm
pg_arraymath_161.1.0el10.aarch64pigsty34.6 KiBpg_arraymath_16-1.1.0-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-arraymath1.1.0d12.x86_64pigsty25.4 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-arraymath1.1.0d12.aarch64pigsty25.2 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-arraymath1.1.0d13.x86_64pigsty25.5 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~trixie_amd64.deb
postgresql-16-pg-arraymath1.1.0d13.aarch64pigsty25.2 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~trixie_arm64.deb
postgresql-16-pg-arraymath1.1.0u22.x86_64pigsty28.1 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~jammy_amd64.deb
postgresql-16-pg-arraymath1.1.0u22.aarch64pigsty28.0 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~jammy_arm64.deb
postgresql-16-pg-arraymath1.1.0u24.x86_64pigsty26.7 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~noble_amd64.deb
postgresql-16-pg-arraymath1.1.0u24.aarch64pigsty26.4 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~noble_arm64.deb
postgresql-16-pg-arraymath1.1.0u26.x86_64pigsty26.6 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~resolute_amd64.deb
postgresql-16-pg-arraymath1.1.0u26.aarch64pigsty26.4 KiBpostgresql-16-pg-arraymath_1.1.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_arraymath_151.1el8.x86_64pigsty33.6 KiBpg_arraymath_15-1.1-2.git20260702.4822319PGSTY.el8.x86_64.rpm
pg_arraymath_151.1el8.aarch64pigsty33.2 KiBpg_arraymath_15-1.1-2.git20260702.4822319PGSTY.el8.aarch64.rpm
pg_arraymath_151.1.0el9.x86_64pigsty34.4 KiBpg_arraymath_15-1.1.0-1PGSTY.el9.x86_64.rpm
pg_arraymath_151.1.0el9.aarch64pigsty33.6 KiBpg_arraymath_15-1.1.0-1PGSTY.el9.aarch64.rpm
pg_arraymath_151.1.0el10.x86_64pigsty34.5 KiBpg_arraymath_15-1.1.0-1PGSTY.el10.x86_64.rpm
pg_arraymath_151.1.0el10.aarch64pigsty34.1 KiBpg_arraymath_15-1.1.0-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-arraymath1.1.0d12.x86_64pigsty24.9 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-arraymath1.1.0d12.aarch64pigsty24.7 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-arraymath1.1.0d13.x86_64pigsty25.0 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~trixie_amd64.deb
postgresql-15-pg-arraymath1.1.0d13.aarch64pigsty24.9 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~trixie_arm64.deb
postgresql-15-pg-arraymath1.1.0u22.x86_64pigsty27.7 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~jammy_amd64.deb
postgresql-15-pg-arraymath1.1.0u22.aarch64pigsty27.6 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~jammy_arm64.deb
postgresql-15-pg-arraymath1.1.0u24.x86_64pigsty26.2 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~noble_amd64.deb
postgresql-15-pg-arraymath1.1.0u24.aarch64pigsty26.0 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~noble_arm64.deb
postgresql-15-pg-arraymath1.1.0u26.x86_64pigsty26.2 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~resolute_amd64.deb
postgresql-15-pg-arraymath1.1.0u26.aarch64pigsty26.0 KiBpostgresql-15-pg-arraymath_1.1.0-1PGSTY~resolute_arm64.deb

源码

pgsql-arraymath-1.1+git20260702.4822319.tar.gz

pig build pkg pg_arraymath;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install pg_arraymath;		# install by package name
pig install arraymath;		# install by extension name

pig install arraymath -v 19;   # install for PG 19
pig install arraymath -v 18;   # install for PG 18
pig install arraymath -v 17;   # install for PG 17
pig install arraymath -v 16;   # install for PG 16
pig install arraymath -v 15;   # install for PG 15

在数据库中创建扩展。

CREATE EXTENSION arraymath;

用法

arraymath: PostgreSQL 的逐元素数组运算

提供整数、浮点数和数值数组的逐元素运算符和工具函数。

CREATE EXTENSION arraymath;

运算符

所有运算符以 @ 为前缀,表示逐元素操作。支持数组对数组(相同长度或循环扩展)以及数组对标量。

运算符说明返回类型
@=逐元素相等boolean[]
@<逐元素小于boolean[]
@>逐元素大于boolean[]
@<=逐元素小于等于boolean[]
@>=逐元素大于等于boolean[]
@+逐元素加法同类型
@-逐元素减法同类型
@*逐元素乘法同类型
@/逐元素除法同类型

函数

函数说明
array_sum(anyarray)所有元素之和
array_avg(anyarray)所有元素的平均值
array_min(anyarray)最小元素
array_max(anyarray)最大元素
array_median(anyarray)中位数元素
array_sort(anyarray)升序排序
array_rsort(anyarray)降序排序

示例

-- 数组与标量
SELECT ARRAY[1,2,3,4] @< 4;             -- {t,t,t,f}
SELECT ARRAY[3.4,5.6,7.6] @* 8.1;       -- {27.54,45.36,61.56}

-- 数组与数组(较短数组循环扩展)
SELECT ARRAY[1,2,3,4,5,6] @* ARRAY[1,2]; -- {1,4,3,8,5,12}
SELECT ARRAY[1,2,3] @= ARRAY[3,2,1];     -- {f,t,f}

-- 工具函数
SELECT array_sort(ARRAY[9,1,8,2,7]);     -- {1,2,7,8,9}
SELECT array_sum(ARRAY[1,2,3,4,5]);      -- 15
SELECT array_median(ARRAY[1,2,3,4,5]);   -- 3

表格阅读器