I am trying to fetch column values as an array in order to use them in the function array_agg_transfn() to calculate the median value as defined in the Postgres Wiki.
The column values of a particular column I fetch based on the current row. For example, 13 rows below the current row. I tried using the following query:
select a."Week_value",
array_agg(a."Week_value")
over(order by prod_name,week_date desc
rows between 0 preceding and 12 following)
from vin_temp_table
But got this error message:
array_agg_transfn called in non-aggregate context
Is it possible to build an array from column-values in the next n rows?
aare invalid.