This is the first time I have fired up postgresql , I think this qualifies as a 101 question.
I am looking for a function to do an excel like percentile function , an sql percentile_cont or percentile_disc or
something. If I have choice, I'd like to write the function in perl.
Copy/change/paste from the manual, I get this far.
CREATE FUNCTION roy2 ( anyarray ) returns real AS $$
print @_ ;
return 10.1 ;
$$ language plperl ;
CREATE AGGREGATE roy (
sfunc = array_append,
basetype = anyelement,
stype = anyarray,
initcond = '{}' ,
finalfunc = roy2
) ;
select roy(foo) from bar ; & I get the error above.
Create an aggregate. The aggregate creates a list. The final function operates on the list to produce a number. At
minimum,the final function involves a sort of some form.
Given the error message , can I do what I want in perl ? choose a different server side language ? give up & extract
thelists in a program, use Statistics::Descriptive & then stick the results back into another table ?
Roy Evans