I am writing a pl / pgsql function that does some statistics processing. using 8.2 postgres. I want to use this convenient aggregate function:
regr_slope (Y, X)
but I have X and Y data stored as local arrays in the pl / pgsql function: y double precision []; x double precision [];
Problemis that I use this as a string in the pl / pgsql function:
slope: = regr_slope (y, x);
I get a message that the function is unavailable or has invalid arguments. I suspect this because the inputs should be selected as columns from a table instead of passing in double precision arrays.
Is there any way to make regr_slope function with local arrays? (i.e. how to pass an array as a valid input for an aggregate function?)
thank.
source
share