ERROR: plperl functions cannot take type anyarray

Поиск
Список
Период
Сортировка
От Evans, Roy
Тема ERROR: plperl functions cannot take type anyarray
Дата
Msg-id 3B59718E023DFB4F9EC949EA299E52E615399A@gbhavmsx01.emea.att.com
обсуждение исходный текст
Ответы Re: ERROR: plperl functions cannot take type anyarray
Список 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 по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Seperate files per function...
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Table Permission?