【发布时间】:2020-12-27 22:59:12
【问题描述】:
似乎 postgres 原生支持带有操作符的数组附加:
|| array-to-array concatenation ARRAY[1,2,3] || ARRAY[4,5,6] {1,2,3,4,5,6}
来源:https://www.postgresql.org/docs/current/functions-array.html。
它本身是否支持向量/元素的算术运算(即,无需为其编写新函数?)
例如:
[1,2,3] + [1,1,1] = [2,3,4]
[1,2,3] - [1,1,1] = [0,1,2]
[1,2,3] * [2,2,2] = [2,4,6]
[1,2,3] / [2,2,2] = [.5, 1, 1.5]
相关问题在这里:Vector (array) addition in Postgres,虽然它大约有 6 年的历史,所以也许从那时起 postgres 发生了变化?
【问题讨论】:
标签: sql arrays postgresql