ERROR: plperl functions cannot take type anyarray

From: "Evans, Roy" <revans(at)emea(dot)att(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: ERROR: plperl functions cannot take type anyarray
Date: 2005-07-12 15:06:28
Message-ID: 3B59718E023DFB4F9EC949EA299E52E615399A@gbhavmsx01.emea.att.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 the lists in a program, use Statistics::Descriptive & then stick the results back into another table ?

Roy Evans

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2005-07-12 15:24:20 Re: Table Permission?
Previous Message Michael Fuhr 2005-07-12 00:24:40 Re: Seperate files per function...