I need to know that to make functions that take multiple rows of arrays and returns a result array.
For example:
Table some_table
id | num_array
1 | [1,1,1]
2 | [2,2,2]
Then running:
SELECT custom_avg(num_array) FROM some_table;
And get a an array with the element-wise operation (avg in this example):
[1.5, 1.5, 1.5]
Something like the standard aggregate functions that operate over rows.
After almost 2 hours of looking at docs and googling I can't find a straight answer to this.
I know the array can be unrolled into a table but I'm trying to avoid that. If this kind of functions can be solved with standard SQL that would be useful too.