ERROR: plperl functions cannot take type anyarray - Mailing list pgsql-novice

From Evans, Roy
Subject ERROR: plperl functions cannot take type anyarray
Date
Msg-id 3B59718E023DFB4F9EC949EA299E52E615399A@gbhavmsx01.emea.att.com
Whole thread Raw
Responses Re: ERROR: plperl functions cannot take type anyarray
List pgsql-novice
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


pgsql-novice by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Seperate files per function...
Next
From: Bruno Wolff III
Date:
Subject: Re: Table Permission?